Creating Jira tickets

This guide shows how to automatically create Jira tickets without going through the UI.

Pre-requisites

We need the list of issue ids. Our official issues v2 doc is linked below.

For example, this is how to get the list of ids for vulnerability issues:

curl -G https://app.fossa.com/api/v2/issues \
  -d 'category=vulnerability' \
  -H 'Authorization: Bearer <token>' | jq -r '.issues | .[] | .id'

How to do it

Creating a Jira ticket involves running the following PUT request below; there are some attributes in the request that are encoded, so ensure you're meticulous about running this endpoint.

PUT https://app.fossa.com/api/v2/issues?category=licensing&scope%5Btype%5D=global&ids%5B0%5D=<first-id>&ids%5B1%5D=<additional-ids>
Query parameters: category=licensing&scope%5Btype%5D=global&ids%5B0%5D=<first-id>&ids%5B1%5D=<additional-ids>

Query parameters (decoded): 

category: licensing | vulnerability
scope[type]: global
ids[0]: id-1
ids[1]: id-2
ids[n]: id-n

Request Payload:

{
	"type": "export",
	"jira": {
		"title": "title",
		"description": "description",
		"trackerId": "project-id",
		"jiraId": 1322,
		"issueType": "Bug",
		"labels": ["label-1", "label-2", "label-n"]
	}
}

Notes:

  • Quick way to get the jiraId is to open up devtools, create a test ticket to get the id from the request payload.
  • Description can have up to 32767 characters. The description is written in markdown.