The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How to add label from command line?

AJ_junichi
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 26, 2021

I deleted a label by executing following from windows command line

curl -X DELETE -u myname@domain:aaaaJyjTW5ELIcZmZd1fQ6F65 "https://domain.atlassian.net/wiki/rest/api/content/942768148/label?name=label_to_delete

 

I want to add a label in a similar manner. My attempt was to execute following but this does not work. 

curl -X POST -u myname@domain.com:aaaajTW5ELIcZmZd1fQ6F65 "https://domain.atlassian.net/wiki/rest/api/content/1004568706/label" --data "[{"prefix":"global", "name": "section_a"}]" -H "X-Atlassian-Token: no-check"

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 28, 2021

Hello,

Happy to help ensure the endpoint is accessible and returning the correct results. To understand what aspect isn't working, could you please either send over the error message to include a (sanitized) screenshot of the output?

Another option would be to run a GET on a page with labels to review the JSON formatting there to ensure what you have matches. 

GET /wiki/rest/api/content/{id}/label  OR GET /wiki/rest/api/content | See Expand metadata.labels 

Regards,
Stephen Sifers

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events