Forums

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

REST API Error 400 Bad Request

Timothy Szczesuil
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!
August 17, 2023

I'm working on a Salesforce - Jira integration. On Postman, the following request is successful:

URI: POST: {{baseUrl}}/rest/api/3/search

BODY: 

{
  "jql": "key in (\"BEW-1111\",\"BEW-1112\")",
  "startAt": "0",
  "maxResults": "2",
  "fields": [
    "id",
    "key"
  ]
}
When I try the same request from Salesforce, I get the error:
{"errorMessages":["Invalid request payload. Refer to the REST API documentation and try again."]}
I had success with a similar request in Salesforce using the GET method with the JQL on the URI and an empty body.
So, what's the issue? Why can't I do an API search with the POST method from Salesforce? Any help would be appreciated.
Tim Szczesuil

2 answers

0 votes
Syed Majid Hassan -Exalate-
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.
August 20, 2023

Hi @Timothy Szczesuil ,

A very warm welcome to the community. This is Majid @ Exalate. 

Your request looks valid to me. So the issue is the parameters included in the request body. Try to run it using cURL/postman and fine tune your variables. One thing I would like to try is to include the issue keys in single quotes instead of escaping the double quotes. 

Also, I would request you to take a look at Exalate if you want to take the pain out of Jira Salesforce integration. 

Hope it helps. 

Thanks

Majid

0 votes
Timothy Szczesuil
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!
August 17, 2023

Cross-posted to Developer Community.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events