POST Upload an Attachment
URL: {{server-url}}/api/upload/file
You can call the above endpoint to upload a file in the ServiceOps system. When you upload a file, you get a reference filename, which you can pass in the body while creating or updating a request ticket; this associates the file with the ticket.
You need the following key-values:
Header
| Key | Description |
|---|---|
| Authorization | Bearer {access token obtained after authorization} |
Body
| Key | Description |
|---|---|
| file | Attachment |
Example (Request & Response)
Request
curl --location 'http://172.16.11.148/api/upload/file' \
--header 'Authorization: Bearer eyJraWQiOiJmbG90by1rZXktaWQiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJqZXJyeUBtb3RhZGF0YS5jb20iLCJ1c2VyX25hbWUiOiJ1dWlkMzYtNDYwYjg1ZGEtNjAzMC00YzVlLWE3OTItZjg2YThiNzIzNzRlIiwiaXNzIjoiaHR0cDovLzE3Mi4xNi4xMS4xNDgvYXBpIiwibG9naW5fc291cmNlIjoiTk9STUFMX0xPR0lOIiwiY2xpZW50X2lkIjoiZmxvdG8td2ViLWFwcCIsImF1ZCI6ImZsb3RvLXdlYi1hcHAiLCJsb2dpbl9zc29faWQiOjAsIm5iZiI6MTc3NjMyNDUwMiwiZ3JhbnRfdHlwZSI6InBhc3N3b3JkIiwic2NvcGUiOlsiTk8tU0NPUEUiXSwiZXhwIjoxNzc2NDk3MzAyLCJsb2dpbl9tc3BfcG9ydGFsX2lkIjowLCJpYXQiOjE3NzYzMjQ1MDIsImp0aSI6IjlkYTE4ODdiLTdmYTctNDZhYi05Zjg1LWMyNTA0OWI5NTg3YiIsInRlbmFudElkZW50aWZpZXIiOiJhcG9sbyJ9.cHPx-vN7i6JkDkczdM6kUwRqmftpLMgyNcHtkAV8CD9n2PQ2sdZv8NfRDMFNwIvluBFBT4HhBn_vwtvlx7eMFb2G0tBKrwxKGjpuIVbVBtQ8nb9up9tnjGbIGmi2OQZUlP4ZOEFjypLChCysOB0QqnTB5fIZ68cX4IKJ5QoSnQ5WAIezu0r7WvuPk0vnj4b2T3vGyjvxnhPTYg0UvY0dfs8lxqPisFIKx0Wt0FgLSGUZiZ2CorJT70xHUaIzkc5yg_YY8vJLL7Y6XsqF1DA-EP7OJdHQ252Um9SKtkWSHT0Pky35PJUK7Z3jC8Acb6vT9iJjGY3o41NrXAr05XTteQ' \
--form 'file=@"/C:/Users/Downloads/Problem Form Rule.pdf"'
Response
{
"id": 49,
"updatedById": 1,
"updatedTime": 1776325073666,
"syncResource": true,
"createdById": 1,
"createdTime": 1776325073666,
"removed": false,
"inActive": false,
"updatebleOob": true,
"deleteableOob": true,
"refFileName": "ec36611d-fe37-41d4-a816-db773ec64e40",
"realName": "Problem Form Rule.pdf",
"name": "ec36611d-fe37-41d4-a816-db773ec64e40"
"size": 2616584,
"encrypted": false,
}
Next, once the response is received, use it while attaching an attachment to the ticket at the time of creation or updation.