Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create macro via REST API

Viktor Peacock
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 24, 2019

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

2 answers

1 vote
Linton Galloway
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 20, 2019

Hi Viktor

I'm looking to do the same thing with the open-api macro, have you made any progress?

Many thanks,

Linton

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 29, 2019

Hello Viktor and welcome to the Community!

To understand more of what we’re trying to achieve here, can you please clarify the following?

Are you attempting to create a macro within Confluence OR are you trying to develop a Confluence page with a macro within the content?

I look forward to your response so we can help to get an answer to this.

Regards,
Stephen Sifers

naveenkumar_dp
Contributor
December 9, 2019

Hi Stephan,

 

I have also facing the same issue.

I wanted to create a confluence page along with the JIRA macro .

Can you please help us on this.

 

Thanks

Naveen

Like Natalya Ozhigova likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events