Links a Jira ticket to a new production job by fetching the ticket's details from Jira and creating a Job record populated with the ticket's metadata (summary, part number, priority, epic link, labels). This is the primary mechanism for importing work orders from Jira into Shop Planr.
The endpoint performs two operations in sequence:
Fetch & create job — Calls the Jira API to retrieve the ticket by key, normalizes the fields using configured mappings, and creates a new job. The job name defaults to the ticket summary (or the ticket key if the summary is empty). The goal quantity is taken from the goalQuantity input parameter, falling back to the ticket's quantity custom field, and finally defaulting to 1.
Apply template (optional) — If a templateId is provided, the specified route template is applied to the newly created job, creating a path with pre-configured process steps. The goalQuantity from the job is used for the path.
The Jira connection must be enabled in settings. Only the enabled toggle is required — pushEnabled is not needed for linking.
The Jira issue key to link (e.g. "PI-42"). Must be a non-empty string. The ticket must exist in Jira.
templateId
string
No
ID of a route template to apply to the new job. When provided, a path is created from the template's steps. If the template is not found, a 404 is returned.
goalQuantity
number
No
Override goal quantity for the new job. If omitted, the quantity is read from the Jira ticket's custom field. If that is also empty, defaults to 1.
The job name is derived from the Jira ticket summary. If the summary is empty, the ticket key is used as the job name.
The goalQuantity resolution order is: request body → Jira custom field → default of 1.
Jira metadata fields (jiraTicketKey, jiraTicketSummary, etc.) are write-once at creation time and cannot be modified via the Update Job endpoint.
Linking does not check for duplicate links. You can link the same Jira ticket to multiple jobs, though this is not recommended.
If a templateId is provided and the template application fails, the job is still created. The error is thrown after job creation, so you may end up with a job but no path.
The template's steps are deep-cloned when applied, so subsequent changes to the template do not affect the created path.