POST call to create a new DBFile, mention the file Name, Type & createFileParent=true in the URL
Having the createFileParent flag in the URL will create the "File" record in the background and that File record can then be linked to the SAI360 parent record
|
CALL Type: POST
URL (example):
http://<WebApp URL>/restapi/component/dbfile?name=Incident1&filetype=jpeg&createFileParent=true
The file data needs to be included in the POST payload as binary data.
On successfully creating the DBFile, the call will return the UniqueId of the DBFile record created, which can then be used in subsequent calls.
|
GET call to get the UniqueId of the File record created (in the background) in the above POST call
|
To retrieve the UniqueId of the File record created (in the background), you need the UniqueId of the DBFile (created in the above step) in the GET URL.
The GET call will return the UniqueId of the File record in the relationship ‘rel_owningfilecomponent’.
CALL Type: GET
URL (example):
http://<WebApp URL>/restapi/component/dbfile('<UniqueId of DBFile from above step>')?$expand=rel_owningfilecomponent
|
PATCH call to link the SAI360 parent record with the File record
|
To attach the File record created in the previous steps to a parent record, you need the UniqueId of the parent record in the patch call URL. In the payload you need to follow the below format to specify the relationship from the parent record to the File record and provide the UniqueId of the File created in the previous step.
CALL Type: PATCH
URL (example):
http://<WebApp URL>/restapi/component/incident(<UniqueId of SAI360 record')
JSON Payload (example):
{
"rel_file_storage": [
{
"@id": "file('UniqueId of File record')"
}
]
}
|