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.
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
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.