Forums

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

Getting an error when using rest into JIRA.

Michael Hall
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 27, 2019

Hi everyone,

I've been tasked with building an integration between ServiceNow and JIRA. I'm getting the following issue when sending a POST to JIRA from ServiceNow. 

  • RESPONSE: {"errorMessages":["No content to map to Object due to end of input"]}

 

From my understanding this seems to be an issue with the JSON but I can send exactly the same JSON to JIRA from Postman and it works perfectly. Any and all help will be appreciated.

Here's a link with the same question posted onto the ServiceNow Community site. It has a bit more information including scripts and JSON. 

https://community.servicenow.com/community?id=community_question&sys_id=0511a591dbde3b00e0e80b55ca9619e6

Thanks for the help,

Mike.

 

REST Endpoint

https://[company].atlassian.net/rest/api/latest/issue

 

JSON -This same JSON was sent to the endpoint above using postman and worked perfectly. I also aimed my script at the postman mock server and that also returned a response. 

{  
   "fields":{  
      "customfield_10031":"[company].service-now:8d2c88e3db1df78060319ee3db9619c0",
      "customfield_10033":"INC0001032",
      "description":"Description 2",
      "issuetype":{  
         "name":"Bug"
      },
      "priority":{  
         "id":"4"
      },
      "project":{  
         "key":"STES"
      },
      "summary":"Short description"
   }
}

 

5 answers

1 vote
Christopher Bui
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!
November 17, 2021

I had this same error message. My issue ws that I was passing the fields object as a query parameter. When I moved it to the body, it worked.

Here's an example of my fields object. It works under version 2. 

{
"fields": {
"summary": "Main order flow broken",
"customfield_xxxxx": "xxxxxxxxx",
"issuetype": {
"id": "xxx"
},
"project": {
"key": "xxx"
},
"description": "Order entry fails when selecting supplier.",
"reporter": {
"id": "xxxxxxxxx"
},
"labels": [
"bugfix",
"blitz_test"
]
}
}

1 vote
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 27, 2019

Hello,

I believe the problem is with the payload (json). You should add your json to the question and the rest endpoint you call.

Michael Hall
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 27, 2019

Thanks I've added the requested items. 

I just wanted to add that I'm running this from a UI action in SNOW which fires off a POST REST to the endpoint. When amending this endpoint to a Postman Mock server it works fine, but as soon as I change it back to the Endpoint above that's when I get the error. 

 

I can also fire off a test POST from outside the script with the exact JSON above and to the final endpoint and it works fine. It seems to be something to do with the script creating the REST call. I've added the community post I have on the ServiceNow website and that has all the scripts in there. 

 

Thanks again.

mathan-ka
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!
October 16, 2020

@Michael_Hall Did you find the solution for this? Can anyone please help me with the solution. I am facing same issue.

0 votes
Georges Berscheid
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!
November 23, 2023

I had this error when trying to access the baseURL using HTTP instead of HTTPS. Due to the HSTS configuration, using HTTP will return status code 301 with header Location: https://<restofthebaseurl>.

Depending on the client, it will not repost the body to the new URL. In curl you'd have to add --post301 for this to happen, the JIRA Java REST client SDK also breaks, and Postman might do this by default.

0 votes
Yatish Madhav
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 24, 2023

Thanks @Lewis Martins  - your comment helped me out here! Thanks for the post and other comments here too ...

0 votes
Georgeta Pojoga September 22, 2021

Does someone have an answer about this? 

Mitchell Budge
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!
November 15, 2021

Still encountering the same issue myself. Clients like Postman or even iOS Shortcuts seem to have no issue uploading a payload to the request, but any RESTful attempts I've given have yielded the same error message. 

Lewis Martins November 29, 2021

@Georgeta Pojoga@Mitchell Budge did you figure this out?  I am having the same problem.  It works from Postman (returned 204 and fields are changed).  When I try from python I get a 400 'No content to map to Object due to end of input' error.

 

I can take the payload from my script and drop into postman without any issues.  My python get requests have no issues.  Haven't tried other puts yet.

Georgeta Pojoga November 30, 2021

For me in the end it was an axios problem, didn't read the documentation and I passed the wrong input. I don't know if this can help :/ 

Like TROADEC Alain likes this
Lewis Martins November 30, 2021

I figured it out.  I was sending the json body as request.payload instead of request.data.

Georgeta Pojoga November 30, 2021

Glad I'm not the only one. :') 

tapan
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!
July 5, 2022

When you hit api from postman it works because postman add some header automatically like "Content-length" and "host", so if you add those in your python code, it will work.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events