I just completed my PM tool using the Jira API and the API I was using was decommissioned. I am trying to convert my /rest/api/2/search?jql=filter= call to a /rest/api/3/search/jql but I am getting a fail on the payload.
Payload
{"jql": "project = "W_Health","startAt": 0,"maxResults": 100,"fields": ["summary","status","assignee","priority","created"]}
Response
{"errorMessages":["There was an error parsing JSON. Check that your request body is valid."]}
Any ideas on what is wrong with the payload?
For Additional Information
Set oHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
oHttp.Open "POST", sURL, False
oHttp.SetRequestHeader "Authorization", sAuthHeader
oHttp.SetRequestHeader "Content-Type", "application/json"
oHttp.Send sPayload
sResponse = oHttp.ResponseText
In addition to what @Bill Sheboy has correctly said, if you get JSON errors, use an online JSON linting / validation tool first to see if your JSON is actually valid.
Alternatively, use an API test tool like Postman that immediately highlights where and when your JSON is invalid.
thanks, can you recommend an online JSON linting / validation tool to try?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes.
You will be presented with a list of recommended online JSON validation tools to try.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hehe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Devon Manelski -- Welcome to the Atlassian Community!
For the payload you show, there is an extra quotation mark in the JQL before the project name.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So I almost have it working, but when I try startAt and MaxResults the payload fails. Any ideas? (The JSON is valid)
Payload
{"jql":"project = \"Health\"","startAt":0,"maxResults":100}
Response
{"errorMessages":["Invalid request payload. Refer to the REST API documentation and try again."]}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any ideas?
Yes.
I think it would be a good idea to actually read the documentation for both of the new Search for issues using JQL enhanced search endpoints, Devon. Then you will see that the new endpoints do not use the startAt parameter (This is because they do pagination differently to the endpoints they have replaced).
Maybe where the error message says "Refer to the REST API documentation" that's meant to be a suggestion, eh?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.