Use APIs to create configurations
Use the StyleBook API to create configurations based on this StyleBook. You can use any tool such as the cURL command line tool or the Postman chrome browser extension to send HTTP requests to NetScaler Console.
Consider the StyleBook example that you created in How to Create a StyleBook to Upload SSL Certificate and Certificate Key Files to NetScaler Console to upload the certificate and key files. Use the REST API to create a configuration pack from the StyleBook as follows:
POST
https://<ADM-endpoint-name>/stylebook/nitro/v2/config/configpacks?mode=async
{ "configpack": { "stylebook": { "name": "lb", "namespace": "com.citrix.adc.stylebooks", "version": "1.1" }, "parameters": { "lb-appname": "lbapp1", "lb-virtual-ip": "192.168.1.1", "lb-virtual-port": "443", "lb-service-type": "SSL", "svc-service-type": "HTTP", "svc-servers": [ { "ip": "193.1.1.1", "port": "80" } ], "certificates": [ { "cert-name": "cert1", "cert-file": { "name": "c3.pem", "contents": "<base64 encoded content>", "encoding_type": "base64" }, "ssl-inform": "PEM", "key-file": { "name": "c3.key", "contents": "<base64 encoded content>", "encoding_type": "base64" } } ] }, "targets": [ { "instance_id": "1b322685-3b23-4111-a9ce-56dd1c659e4c" } ] } } } <!--NeedCopy--> This returns a Job ID that can be used to track the completion of the configuration job:
{ "job": { "job_id": "388922985" } } <!--NeedCopy--> Use the job polling API to find out the status of the job and when the configuration job is complete:
GET
https://<ADM-endpoint-name>/stylebook/nitro/v2/config/jobs/388922985
200 OK { "job": { "job_id": "388922985", "status": "completed", "progress_info": [...], "result": { "config_key": "388922985", "created_by": "nsroot", "created_datetime": "2023-01-14 01:46:05.410998", "created_datetimestamp": "2023-01-14 01:46:05", "id": "388922985", "incarnation_number": "0", "last_modified_by": "nsroot", "last_modified_datetime": "2023-01-14 01:46:05", "lock": "Y", "name": "sample-dns-stylebook", "namespace": "com.citrix.adc.tests", "primary_keys": "{}", "sb_id": "samp4ed0c4c90aefaadaff6422b0c395f67f", "status": "completed", "target_devices_json": "[{\"instance_id\": \"49a45044-ceb3-4e9d-8a5d-e3fe225d90ed\", \"id\": \"1833061454\", \"group_id\": \"\", \"instance_ip\": \"192.168.153.165\", \"hostname\": \"ctx-adc-dc01-v-prod-54\", \"instance_role\": \"[\\\"default\\\"]\", \"incarnation_number\": \"0\"}]", "tenant_id": "1a45fd70-7ce3-4bff-8642-1bd7f7e97673", "version": "1.0" } } } <!--NeedCopy--> The job ID (388922985) identifies the configuration pack. You can use this ID to query, update, or delete the configuration.