Hey,
I have built a workflow that among other things, creates a some Jira Tickets. I get errors while linking the Jira Tickets with each other.
Purpose: Jira Ticket 1 relates (blocks, is blocking, relates) to Jira Ticket 2.
I have created a HTTP node and used:
Method: GET
URL: https://<>.atlassian.net/rest/api/3/issueLink
Authentication: None
Specify Headers:
{
“Authorization”: “Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”,
“Accept”: “application/json”,
“Content-Type”: “application/json”
}
Can you please help me solve this case?
Correct call example:
Method: POST
URL: https://<your-domain>.atlassian.net/rest/api/3/issueLink
Headers:
{
"Authorization": "Basic xxxxxxxxxxxxxxxxxx",
"Accept": "application/json",
"Content-Type": "application/json"
}
Body (JSON):
{
"type": {
"name": "Relates"
},
"inwardIssue": {
"key": "TICKET-123"
},
"outwardIssue": {
"key": "TICKET-456"
}
}
Hey @Erick_Torres ,
Thank you for your quick response and for your help! I highly appreciate it!
Followed the steps that you described above and the error that I get is “Invalid JSON in response body”.
This is what the exact error description looks like:
{
“errorMessage”: “Invalid JSON in response body”,
“errorDetails”: {},
“n8nDetails”: {
“n8nVersion”: “1.91.2 (Cloud)”,
“binaryDataMode”: “filesystem”,
“stackTrace”: [
“Error: Invalid JSON in response body”,
" at jsonParse (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/utils.js:110:19)“,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:661:65)”,
" at processTicksAndRejections (node:internal/process/task_queues:95:5)“,
" at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:687:27)”,
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:921:51",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:1257:20"
]
}
}
Thank you once more!
Let’s check again. The problem is that the JSON expected by the Jira API expects a different structure.
1- Endpoint and Method
POST https://.atlassian.net/rest/api/3/issue
Must be done with the POST method.
2- Required Headers
Authorization: Basic <BASE64(email:api_token)>
Accept: application/json
Content-Type: application/json
This ensures basic authentication and JSON format.
3- JSON Body: Basic Structure
The JSON must have a root field “fields” with the ticket attributes:
{
“fields”: {
“project”: {
“key”: “PROJ”
},
“issuetype”: {
“name”: “Bug”
},
“summary”: “Ticket Title”,
“description”: “More detailed description of the issue”
}
}
Example with project key and issue type name
{
“fields”: {
“project”: { “key”: “TEST” },
“summary”: “REST ye merry gentlemen.”,
“description”: “Creating a ticket using the REST API”,
“issuetype”: { “name”: “Bug” }
}
}
Expected response:
{
“id”: “39000”,
“key”: “TEST-101”,
“self”: “https://…/issue/39000”
}
Alternatively, using IDs instead of names is the internal project IDs and issue type:
{
“fields”: {
“project”: { “id”: “10110” },
“issuetype”: { “id”: “1” },
“summary”: “No REST for the Wicked.”,
“description”: “Using IDs instead of names”
}
}
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.