Forums

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

500 Error when adding web link to Confluence page content via API

Angelo Loria
Contributor
June 18, 2019

I'm attempting to update a Confluence page via API using curl as part of a Jenkins pipeline (groovy code.)

My curl data looks like this (ignore the indentation):

  --data \'{ 
\"version\": { \"number\": 12 },
\"title\": \"PageTitle\",
\"type\": \"page\",
\"body\": {
\"storage\": {
\"value\": \"URL: <a href=\"https://testUrl.net/wiki/\">https://testUrl.net/wiki/</a></p>\",
\"representation\": \"storage\"
}
}
}\'

 The error I'm getting is this:

{"statusCode":500,"message":"org.codehaus.jackson.JsonParseException: Unexpected character ('h' (code 104)): was expecting comma to separate OBJECT entries\n at [Source: com.atlassian.plugins.rest.common.limitrequest.jersey.LimitingRequestFilter$1@700a4af8; line: 9, column: 184]"}

I've tried every combination of double and single quotes around that string that I can think of.  

1 answer

0 votes
Ian Ragudo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 19, 2019

In your JSON payload, since you're using single quotes, you can remove the backslash to escape double quotes (aside from the one inside storage value) like

--data '{ 
"version": { "number": 12 },
"title": "PageTitle",
"type": "page",
"body": {
"storage": {
"value": "URL: <p><a href=\"https://testUrl.net/wiki/\">https://testUrl.net/wiki/</a></p>",
"representation": "storage"
}
}
}'

I also added <p> in the body since you have a trailing </p>.

Hope this helps.

Ian

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events