I am getting a Bad Request with an Error Code 400 issue. find the below Json Request.
Working in UAT but not in production. Please let me know if any suggestions.
{
"fields": {
"summary": "Testing 123 - Push to Jira",
"reporter": {
"id": "5fb422c74a09640069d1***"
},
"project": {
"id": "10297"
},
"issuetype": {
"id": "10004"
},
"description": {
"version": 1,
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Problem Description:",
"marks": [
{
"type": "strong"
}
]
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Delete when done"
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Steps to Reproduce:",
"marks": [
{
"type": "strong"
}
]
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "N/A"
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Desired Result:",
"marks": [
{
"type": "strong"
}
]
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "N/A"
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Actual Result:",
"marks": [
{
"type": "strong"
}
]
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "N/A"
}
]
}
]
},
"customfield_10204": "PR-0004956",
"customfield_10172": {
"value": "Moderate"
}
}
}
Hi @Vigneshwar Kotha ,
What API are you trying to use here?
Perhaps you can explain the use case a little bit, it may help identify the cause or even get a suggestion to another approach
Hi Jehan,
Thank you for Response.
Actually, I am trying to create a Jira issue from Salesforce. Able to create JIRA issue from other sandboxes but getting issue in production. This is the API am using.
API: Endpoint=https://**.atlassian.net/rest/api/3/issue, Method=POST
This is the Error : Status=Bad Request, StatusCode=400
I have compared my request with production and other sandboxes.It seems same but getting Bad Request Issue.Please find the above request data.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Vigneshwar Kotha ,
The Post request would need a Body to send, would it be possible to share that as well?
You can paste it as a "code block" In your response so that it is more clear to view.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
{"fields":{"summary":"Testing 123 - Push to Jira","reporter":{"id":"5fb422c74a09640069d1f4a6"},"project":{"id":"10297"},"issuetype":{"id":"10004"},"description":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Problem Description:","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"type":"text","text":"Delete when done"}]},{"type":"paragraph","content":[{"type":"text","text":"Steps to Reproduce:","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"type":"text","text":"N/A"}]},{"type":"paragraph","content":[{"type":"text","text":"Desired Result:","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"type":"text","text":"N/A"}]},{"type":"paragraph","content":[{"type":"text","text":"Actual Result:","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"type":"text","text":"N/A"}]}]},"customfield_10204":"PR-0004956","customfield_10172":{"value":"Moderate"}}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vigneshwar Kotha ,
I checked the request in Postman, and it works with the body that you provided.
What custom fields are these? There is a chance that you've got to update the format for them
"customfield_10204", "customfield_10172"
I tried a Multi-line text field and got this response :
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Those two custom fields are Record Name and Severity. Record Name is text Field and Severity is a picklst field. Both values are getting as expected from salesforce. Fields type and access is same as other instances.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the last Image I added, you can see an error, perhaps you can share the error you receive when the 400 response is shown.
If you're using an internal Saleforce related UI, and no error is displayed there, you can check the browser network tab to see the error (use F12 to open Dev Tools and then open "Network")
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.
And I am trying from Postman as well. getting different issues. It is Unauthorised 401 and showing don't have access to the project. but I do have access to the project and I can manually create issues into the project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any option to display the Error response along with the error code?
Also, do you configure the API on a desktop app or is this via a Browser app or Curl?
Since each might have a different syntax.
Have you tried firing that API via postman too? Or a different tool perhaps too see if the platform from which you're firing the API may have an issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for the postman API you need to use Basic auth.
Uswrname is your Jira username, and password is your API token.
Note: pls delete the previous image since it have your token visible.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As you said, user Basic Auth with Username and API token. Getting bellow error.
When i remove Reporter from the payload, it is giving success. Can you please suggest ?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yupp
That seems like it.
Try removing that from your Salesforce API body too and retry the API
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Vigneshwar Kotha ,
Do let us know how it goes after editing the body of the API request.
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post , as the documentation "reporter" field doesn't seem to be needed.\
If this thread helped solve your issue, please mark it as Accepted so that it's more visible to the other community members.
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.