I'm trying to create a page with labels:

java code:

URL obj = new URL(urlCnfl + "/rest/api/content/");
HttpURLConnection conn = (HttpURLConnection) obj.openConnection();
conn.setRequestProperty("Content-Type", "application/json");
String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(authString.getBytes("UTF-8"));
conn.setRequestProperty ("Authorization", basicAuth);

def data='{'+
' "title": "title542764234534",'+
' "space": {'+
' "key": "SAUR"'+
'"type": "page",'+
'"metadata": {'+
'"labels": ['+
'"prefix": "global",'+
'"name": "label1"'+
' "prefix": "global",'+
' "name": "label2"'+
' }'+
' ]'+
' },'+
' "body": {'+
' "storage": {'+
' "value": "New page data",'+
' "representation": "storage"'+
' }'+
' }'+

OutputStreamWriter out = new OutputStreamWriter(conn.getOutputStream());


json data from your example to create a page. The page is created, all data is correct, except for labels, they are not. 

what's the matter? Thank you!

1 answer

0 votes
Thomas Schlegel Community Champion Apr 07, 2017

Hi Aleksey,

there's another community for developer's issues:
Maybe you get an answer there sooner

BTW, I would not use my email-address as username. This is in invitation for spam...

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,099 views 17 14
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you