Use API to import custom StyleBooks

Jul 25, 2018

You can now use the StyleBook APIs to import custom StyleBooks into NetScaler MAS. Use REST API to create a configpack from this StyleBook as follows in any tool such as the curl command line tool or the Postman chrome browser extension. For example, you can import a StyleBook named example-lb that can be used to create a load balancer configuration on a NetScaler instance.

HTTP Method: POST 

URL: http://<mas-ip>/stylebook/nitro/v1/config/stylebooks


Content-Type: application/json

Accept: application/json

Request Body:



         “file_name”: “example-lb.yaml”,





where, the “source” attribute’s value, is the base64 encoding of the contents of your StyleBook file. You can paste the YAML contents of your StyleBook file in an online tool, for example, to obtain the base64 string that you can then use as a value for the “source” attribute above.

Using this API call, you can also upload a compressed tarball file (.tgz file) containing multiple StyleBook files in one API operation. To do this, simply change the file_name attribute to the .tgz filename and the value for the source attribute to the base64 encoding of the contents of your .tgz file.

After the API is run successfully in the tool you get the following response that indicates that the StyleBook has been imported into NetScaler MAS.

200 OK

Response Body:


  “stylebook”: {

    “name”: “example-lb”,

    “namespace”: “com.example.stylebook”,

    “version”: “1.0”



Use API to import custom StyleBooks