Create Ticket

Creates a new ticket.

Required Permissions

Requires the MEMBER role or higher.

HTTP Request

POST /api/sonar/tickets
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d repo_guid=5f0ba741-7551-400d-8bd6-1f14a6e8536d \
     -d guid=638cfeb2-e259-46af-961a-1eeb65ea35f0 \
     -d priority=LOW \
     -d title="Attempt to collect web server settings" \
     -d format=JSON \
     --data-urlencode content="{""first_seen"":""2022-09-20 14:55:54+0900"",""last_seen"":""2022-09-20 14:55:54+0900"",""priority"":""LOW"",""src_ip"":""3.83.23.230"",""dst_ip"":""13.125.82.152"",""dst_port"":443}" \
     -X POST \
     https://HOSTNAME/api/sonar/tickets
Request Parameters
KeyRequiredTypeDescriptionNote
repo_guidYesStringTicket repository GUID36 characters
guidYesStringTicket GUID36 characters
priorityYesStringPriorityLOW or MEDIUM or HIGH
titleYesStringTitleMinimum 1 to maximum 255 characters
formatYesStringContent formatJSON or MARKDOWN or PLAIN
contentYesStringContentMinimum 1 to maximum 100,000 characters
assigneesNoList (of strings)Assignee GUID listComma-separated list
approversNoList (of strings)Approver GUID listComma-separated list
attachmentsNoList (of strings)Attachment GUID listComma-separated list
tagsNoString listTag GUID listMultiple GUIDs separated by ,
Note
Attachments refer to file objects that have already been uploaded, so they can exist before the ticket is created. Unreferenced ticket file objects are automatically destroyed at midnight each day.

Success Response

{
  "guid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Error Responses

Required argument is missing

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "title should be not null"
}
Invalid argument length

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "'title' must be shorter than or equal to 255 characters."
}
Invalid format specified

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "format should be one of 'JSON', 'MARKDOWN', 'PLAIN'."
}
Invalid priority value

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "priority should be one of 'LOW', 'MEDIUM', 'HIGH'."
}
Content is not in JSON format

An error occurs when the format is JSON but the content is not valid JSON.

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "content should be JSON format - Expected a ',' or '}' at character 146"
}
A value in the assignee, approver, or attachment list is not in valid GUID format

HTTP status code 400

{
  "error_code": "invalid-param-type",
  "error_msg": "assignees should be guid type."
}
Duplicate ticket GUID is found

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "duplicated ticket guid: 638cfeb2-e259-46af-961a-1eeb65ea35f0"
}
Ticket repository is not found

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "ticket repository not found: 5f0ba741-7551-400d-8bd6-1f14a6e8536d"
}
Assignee is not found

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "assignee not found: fae7fa2b-756e-4d3d-b314-e631daf70c7a"
}
Attachment is not found

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "attachment not found: 8e904789-b9b9-443a-b1a1-86a36119c74c"
}
Permission denied

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "no-permission"
}