Save rendered config as staged config
This guide explains how to save a Submission response as a new Staged Config.
The workflow involves two main steps:
- Submit templates for preview - Use the Submit Templates Guide to render configuration
- Save as staged config - Create a staged configuration object from the preview
First, use the Submit templates API operation to preview the configuration.
You can save an NGINX configuration preview as a staged config, even if it contains parse errors.
Use the config
object from the API response in step 1 to create a staged configuration.
Use the Create a staged config API operation.
Take the entire config
object from the template submission response and wrap it in a name
field.
Required fields:
name
- Descriptive name for the staged configurationconfig
- The completeconfig
object from the template submission response
Optional fields:
description
- Details about the configuration purpose or changes
Here’s an example of what you need to include with the API request:
{
"name": "API Gateway",
"description": "Reverse proxy configuration with CORS headers and health check endpoint",
"config": {
"aux": [],
"conf_path": "/etc/nginx/nginx.conf",
"config_version": "17qlLiPmAqIWhhYxmVieE9mC5t92e+/7gIvz0GFRj/E=",
"configs": [
{
"name": "/etc/nginx",
"files": [
{
"name": "nginx.conf",
"contents": "<base64_encoded_content>",
"mtime": "0001-01-01T00:00:00Z",
"size": 371
}
]
},
{
"name": "/etc/nginx/conf.d/augments",
"files": [
{
"name": "cors-headers.tmpl.4aaf36d4a643.conf",
"contents": "<base64_encoded_content>",
"mtime": "0001-01-01T00:00:00Z",
"size": 159
},
{
"name": "health-check.tmpl.78346de4dae4.conf",
"contents": "<base64_encoded_content>",
"mtime": "0001-01-01T00:00:00Z",
"size": 109
}
]
}
]
}
}
Successful response (201 Created):
{
"name": "API Gateway",
"object_id": "sc_lGsm5mn2SW2dWUe8CmOOOg"
}