Unable to add attachment to an Incident through REST API(postman/java)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2018 11:22 PM
We are trying to upload an attachment for an incident in Kingston, we have passed table_name and table_sys_id properly and contentType as multipart/formdata We are able to create an attachment and but the attachment is not being linked to the incident and it was giving an issue below:
{
"error": {
"message": "Failed to create the attachment. File part might be missing in the request.",
"detail": null
},
"status": "failure"
}
The same is working from service now REST API explorer.
Thanks in advance and you quick help would be highly appreciated.
Regards,
Balamurali
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2018 01:29 PM
Playing around with this a bit, I pulled a cURL code sample for this. Make sure your headers match this format:
curl "https://dev28630.service-now.com/api/now/attachment/upload" \
--request POST \
--header "Accept:application/json" \
--user 'admin':'admin' \
--header "Content-Type:multipart/form-data"
I noticed in your description you were missing the '-' in form-data. Double check your content type in postman. I'd also double check the table_sys_id is correct. Next, I'd double check the file size of your attachment. If it's larger than 2MB, it might be breaking it up into parts and some parts aren't being sent.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2018 09:50 PM
Hi Dylan,
Thanks for your reply.
We have given the content-type as multipart/form-data and the file size is very less. We have tried with REST API explorer with same parameters and it was working fine, and it was not working from postman with the same details and giving the error "
"Failed to create the attachment. File part might be missing in the request."
FYI with SOAP we are able to upload large files as well.
Thanks,
Balamurali