Skip to main content
PATCH
/
api
/
cases
/
{id}
/
document
Add document to a case
curl --request PATCH \
  --url http://localhost/api/api/cases/{id}/document \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'name=<string>' \
  --form document='@example-file'
import requests

url = "http://localhost/api/api/cases/{id}/document"

files = { "document": ("example-file", open("example-file", "rb")) }
payload = { "name": "<string>" }
headers = {"Authorization": "Bearer <token>"}

response = requests.patch(url, data=payload, files=files, headers=headers)

print(response.text)
const form = new FormData();
form.append('name', '<string>');
form.append('document', '<string>');

const options = {method: 'PATCH', headers: {Authorization: 'Bearer <token>'}};

options.body = form;

fetch('http://localhost/api/api/cases/{id}/document', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "http://localhost/api/api/cases/{id}/document",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "http://localhost/api/api/cases/{id}/document"

payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("http://localhost/api/api/cases/{id}/document")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();
require 'uri'
require 'net/http'

url = URI("http://localhost/api/api/cases/{id}/document")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"

response = http.request(request)
puts response.read_body
{
  "id": 123,
  "case_status": "<string>",
  "ageing": 123,
  "priority": 123,
  "case_status_order": 123,
  "alert_date": "<string>",
  "assignee": {
    "id": 123,
    "name": "<string>"
  },
  "bucket": {
    "id": 123,
    "name": "<string>"
  },
  "case_action": "<string>",
  "case_subjects": {
    "subject_1": {
      "id": 123,
      "name": "<string>",
      "client_subject_id": "<string>"
    },
    "subject_2": {
      "id": 123,
      "name": "<string>",
      "client_subject_id": "<string>"
    }
  },
  "created_on": "<string>",
  "rule": 123,
  "active_timestamp": "2023-11-07T05:31:56Z"
}
{
"detail": "<string>"
}
{
"detail": "<string>"
}
Requirements
  • IsCaseAssigneePermission User
  • Document must be a File
  • Document extension must be .png, .jpg, .jpeg, or .pdf
  • Document size must be smaller than 10mb

Authorizations

Authorization
string
header
required

JWT token obtained from AWS Cognito or custom authentication service

Path Parameters

id
integer
required

A unique integer value identifying this case.

Body

multipart/form-data
name
string
required

Document name.

document
file
required

Document file.

Response

Document added successfully.

Case object with all details

id
integer
required

Case ID

case_status
string
required

Current case status

ageing
integer

Days since case creation

priority
integer

Case priority level

case_status_order
integer

Internal case status order

alert_date
string

Alert date timestamp

alert_risk_rating
enum<string>

Risk rating

Available options:
HIGH,
MEDIUM,
LOW,
Unrated
assignee
object

Case assignee information

bucket
object

Bucket information

case_action
string

Last action taken on case

case_subjects
object

Case subjects information

created_on
string

Case creation date

rule
integer

Rule number ID that triggered the case

active_timestamp
string<date-time>

When case became active