Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Create macro via REST API Edited

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

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

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

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

302 views 23 8
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you