Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Getting Invalid UTF-8 start byte 0xa0 Confluence REST API

Hi ,

I am getting the below error in Confluence logs while trying to create content in Confluence via it's REST API. I have written a Java client that makes the REST API call to https://<our_confluence_host>/confluence/rest/api/content with json paylaod to craete a page. It uses apache httpclient to make the call.

Below are the http request headers :

request.setHeader("Accept", "application/json");

request.setHeader("Content-Type", "application/json"); 

HttpResponse response = httpClient.execute(request);

 

I am getting http status code 500. The Confluence server's application logs prints the below stacktrace. This is an blocker issue for us. Any help is highly appreciated.

I even tried setting "Content-Type" header as "application/json:charset=UTF-8" but taht also did not help.

2018-05-24 10:20:52,760 ERROR [http-nio-8090-exec-8] [rest.api.model.ExceptionConverter] convertServiceException No status code found for exception, converting to internal server error :
-- url: /confluence/rest/api/content | traceId: 8f2a32f5543f5461 | userName: _stagegitportal
org.codehaus.jackson.JsonParseException: Invalid UTF-8 start byte 0xa0
at [Source: com.atlassian.confluence.plugins.restapi.filters.LimitingRequestFilter$1@50455f9c; line: 1, column: 951]
at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)
at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)
at org.codehaus.jackson.impl.Utf8StreamParser._reportInvalidInitial(Utf8StreamParser.java:2825)
at org.codehaus.jackson.impl.Utf8StreamParser._reportInvalidChar(Utf8StreamParser.java:2819)
at org.codehaus.jackson.impl.Utf8StreamParser._finishString2(Utf8StreamParser.java:1978)
at org.codehaus.jackson.impl.Utf8StreamParser._finishString(Utf8StreamParser.java:1905)
at org.codehaus.jackson.impl.Utf8StreamParser.getText(Utf8StreamParser.java:276)

1 answer

0 votes
Thomas Deiler Community Leader May 24, 2018

Dear @Ayaskant Swain,

it seems that the JSON data you send is not correctly encoded. Try

URLEncoder.encode(data,"UTF-8");

before executing the request, Btw: The header seems to be fine,

So long

Thomas

Hi Thomas,

 

I tried that but it did not work either :-( . Strangely the same jsonpayload works when i call the API via POSTMAN. Page is created successfully in Confluence.

The POSTMAN sends the below headers.

headers = {
'content-type': "application/json",
'accept': "application/json",
'cache-control': "no-cache",
'postman-token': "34a891d4-52f1-649e-3fff-298f207ac2a5"
}

 

The "cache-control" and "postman-token" headers have been added by POSTMAN internally. I don't think they are making any difference and should be added in my Java client program.

The json request payload is below:

 

{\"type\":\"page\",\"title\":\"ECMC TROUBLESHOOTING PROCEDURES_30\",\"space\":{\"key\":\"DEVPROD\"},\"body\":{\"storage\":{\"value\":\"h1. NOT WORKING\\n\\nFor most of the possible problems below, start with these steps.\\n\\n* Check when the config was last updated.\\n* Check to see how long the current config is active.\\n* If the current production config was recently activated, run a diff to compare the current with previous active config.\\n\\nh2. VERIFY_CONFIG_ACTIVATION\\n|| Action || Result ||\\n| \\n# Log in to the ECMC and see if the configuration file containing the digital property having problems was recently changed.  \\n# Select View Details and look at the data of the more resent revision pushed to production | \\n# If a recent change was made, the timestamp will be recent, or the configuration may still be propagating to the network. |\\n\\nh2. VERIFY_ORIGIN_IP_CHANGES\\n|| Action |","representation":"wiki"}}}

 

Thanks

Ayaskant

Thomas Deiler Community Leader May 25, 2018

Dear @Ayaskant Swain,

probably its a JVM properties issue - but this is just a wild guess. If you paste the whole class, where you construct the request, I can probably help you debugging.

So long

Thomas

Can someone help in this regard?

Thomas Deiler Community Leader Feb 18, 2019

Dear @sudheer gaddam ,

where do you need help?

So long

Thomas

@Ayaskant Swain  @Thomas Deiler  

Hi, I am using post method when I am passing the same payload using postman it is creating the account. but when I am creating using python code it is giving 400 error and UTA-8 start byte 0xa0 at column line1 and column 118.

I am creating three tickets passing two are passing and 1 is failing, and my pay load is

This is the error payload where the ticket is not creating. 

{"fields": {"project": {"key": "ABC"},"parent": {"key": "ABC-19"}, "summary": "Update Release Calendar  - A B Platform - 4.0","description": " Release calendar gets updated here - https://confluence.xyz.com/display/AB/Release+Calendar","issuetype": { "name": "Sub-task","subtask": true},"assignee": {"name": "RAM"}, "labels":["PAYLOAD", "XYZ"]}}

These are my headers

'Cache-Control': 'no-cache',
'Authorization': jira_auth,
'Cookie': jira_cookie,
'Content-Type': 'application/json',
'Accept': '*/*',

 

Can you help me with this

Hey I got solution the only thing is, i am adding one additional space bar in my text.

Suggest an answer

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

🥓🙅🏻‍♀️ Meet-less May Badge!

Hello Confluence Community!  What if i told you that you could have a healthier life and be 100% meet-less? This month, we're promoting a healthy, balanced work diet with Confluence. We la...

188 views 2 13
Read article

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