Upload Attachments
3 min
you can upload attachments to business objects the details of the method, request body, and headers to execute the upload attachment api are as given in the table below base url https //{tenant url}/api/rest/attachment \<font color="#ffffff">method\</font> post header name authorization jtw token/session key/rest api key \<font color="#ffffff">request body\</font> key value value format value objectid text business object recid objecttype text business object type file file name of the attachment form data upload attachments example here is an example to upload an attachment to an incident business object url https //{tenant url}/api/rest/attachment \<font color="#ffffff">method\</font> post header name authorization jtw token/session key/rest api key \<font color="#ffffff">request body\</font> key value value format value objectid text 1968c01efab244ad8c67648e7578a30e objecttype text incident# file invoice png file billofmaterial png form data \<font color="#ffffff">status code\</font> 200 \<font color="#ffffff">response header\</font> \[ { "filename" "invoice png", "isuploaded" true, "message" "1968c01efab244ad8c67648e7578a30e" }, { "filename" "billofmaterial png", "isuploaded" true, "message" "1968c01efab244ad8c67648e7578a30e" } ] when attachment is successful, the unique id of the attachment is displayed in the response header message unsuccessful responses re attaching an existing file scenario uploading two files to a business object where one of the file already exists in the business object example https //{tenant url}/api/rest/attachment header name authorization sessionkey code ism 3000 description validation error message \[ { "filename" "cimapbutton png", "isuploaded" true, "message" "fe36f27ebcf64a7bb88d9425e9738c08" }, { "filename" "choosefilesbutton png", "isuploaded" false, "message" "upload failed, a file with the name 'choosefilesbutton png' is already attached to this object please change the name " } ] \<font color="#ffffff">http status code\</font> 300 the code 300 indicates, multiple responses, some success and some unsuccessful the message contains the details of the success and unsuccessful responses attaching an unsupported file type scenario trying to attach an unsupported file type example https //{tenant url}/api/rest/attachment header name authorization sessionkey code ism 3000 description validation error message \[ "upload failed invalid attachment type attach a valid file type and try again" ] \<font color="#ffffff">http status code\</font> 300
