Hi,
I am using REST API to dynamically create content. My goal is to:
- Create a page
- Create OPEN Swagger Macro within that page {open-api} JSON {open-api} with JSON content inside it
When posting this via the API, I end up with the following:
{open - api} {
"swagger": "2.0",
"info": {
"version": "v1",
"title": "My API"
},
"paths": {
"/api/Values": {
"get": {
"tags": ["Values"],
"operationId": "Get",
"consumes": [],
"produces": ["text/plain", "application/json", "text/json"],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"schema": {
"uniqueItems": false,
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"post": {
"tags": ["Values"],
"operationId": "Post",
"consumes": ["application/json-patch+json", "application/json", "text/json", "application/*+json"],
"produces": [],
"parameters": [{
"name": "value",
"in": "body",
"required": false,
"schema": {
"type": "string"
}
}],
"responses": {
"200": {
"description": "Success"
}
}
}
},
"/api/Values/{id}": {
"get": {
"tags": ["Values"],
"operationId": "Get",
"consumes": [],
"produces": ["text/plain", "application/json", "text/json"],
"parameters": [{
"name": "id",
"in": "path",
"required": true,
"type": "integer",
"format": "int32"
}],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "string"
}
}
}
},
"put": {
"tags": ["Values"],
"operationId": "Put",
"consumes": ["application/json-patch+json", "application/json", "text/json", "application/*+json"],
"produces": [],
"parameters": [{
"name": "id",
"in": "path",
"required": true,
"type": "integer",
"format": "int32"
}, {
"name": "value",
"in": "body",
"required": false,
"schema": {
"type": "string"
}
}],
"responses": {
"200": {
"description": "Success"
}
}
},
"delete": {
"tags": ["Values"],
"operationId": "Delete",
"consumes": [],
"produces": [],
"parameters": [{
"name": "id",
"in": "path",
"required": true,
"type": "integer",
"format": "int32"
}],
"responses": {
"200": {
"description": "Success"
}
}
}
}
},
"definitions": {}
} {open - api}
Whilst JSON is there, the macro is not initialised. My question is how to correctly create and initialise macros via REST API.
The JSON represents a Swagger schema for a dummy API.
Thank you,
Viktor