Skip to main content

Hi,

When using the REST Web Services POST method to upload an attachment on ServiceNow, I am continuously getting the following error:

{"error":{"message":"Failed to create the attachment. File part might be missing in the request.","detail"

},"status":"failure"}

I have tested via Postman with exactly the same headers and user credentials, and it works. The service also works via the ServiceNow REST API service.

I have tried copying the exact same headers from Postman when it worked, but with no luck. I have also tried different files, as I feel this could be the issue, but I am always getting this error.

Any support with this issue would be appreciated.

Thanks, Brett

That’s an interesting question, Brett Alt !

I think the following community members may be able to help 

@Marc Mueller 

@Vatsy 

@Zaid Chougle 

@Tamil Arasu10 

@madhu subbegowda 

@jackson 

@HARUN KUMAR 

@NewTushitha 

@Azhar Hossain 

@kdil 

@Padmakumar 


@Brett Alt 

Use cURL via "Run Script" (Recommended)

Offload the multipart file upload to cURL, which handles all the formatting and headers perfectly:

curl -X POST "https://<instance>.service-now.com/api/now/attachment/file?table_name=incident&table_sys_id=<sys_id>&file_name=sample.txt" \
--header "Accept:application/json" \
--header "Authorization: Basic <base64-encoded-credentials>" \
--form "file=@C:/Path/To/sample.txt"

 


Reply