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
| Key | Required | Type | Description | Note |
|---|---|---|---|---|
| repo_guid | O | String | Ticket repository GUID | 36 characters |
| guid | O | String | Ticket GUID | 36 characters |
| priority | O | String | Priority | LOW or MEDIUM or HIGH |
| title | O | String | Title | Minimum 1 to maximum 255 characters |
| format | O | String | Content format | JSON or MARKDOWN or PLAIN |
| content | O | String | Content | Minimum 1 to maximum 100,000 characters |
| assignees | X | List (of strings) | Assignee GUID list | Comma-separated list |
| approvers | X | List (of strings) | Approver GUID list | Comma-separated list |
| attachments | X | List (of strings) | Attachment GUID list | Comma-separated list |
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
{}
Error Responses
Required argument is missing
HTTP status code 400
{
"error_code": "null-argument",
"error_msg": "repo_guid 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 priority value
HTTP status code 400
{
"error_code": "invalid-argument",
"error_msg": "priority should be one of 'LOW', 'MEDIUM', 'HIGH'."
}
Invalid format specified
HTTP status code 400
{
"error_code": "invalid-argument",
"error_msg": "format should be one of 'JSON', 'MARKDOWN', 'PLAIN'."
}
Content is not in JSON format
When the content format(format) is specified as JSON, an error occurs if the content is not in JSON format.
{
"error_code": "invalid-argument",
"error_msg": "content should be JSON format - Expected a ',' or '}' at character 146"
}
List of assignees or approvers has non-GUID value
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"
}
Assignee or approver 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"
}