Error while calling the rest attachment API using POSTMAN. "message": "Failed to create the attachment. File part might be missing in the request."

krishmur78
Kilo Contributor

Issue : Error while calling the rest attachment API using POSTMAN. "message": "Failed to create the attachment. File part might be missing in the request."

Error:

{

      "error": {

              "detail": null,

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

      },

      "status": "failure"

}

3 REPLIES 3

Gaurav Bajaj
Kilo Sage

Hi,



Please share the request body of it.



Thanks


Gaurav


karan chhabra5
Tera Contributor

[{"key":"table_name","value":"incident","description":"","type":"text","enabled":true},{"key":"table_sys_id","value":"d4257ded4f301b00ba7653418110c77f","description":"","type":"text","enabled":true},{"key":"","value":{"0":{}},"description":"","type":"file","enabled":true}]

Gaurav Bajaj
Kilo Sage

Hi Karan,

You need to pass the binary data as part of the file in your body request as there are only two ways to add an attachment to a record in ServiceNow through attachment API.

find_real_file.png

What you can do here is use the binary method to achieve it with POSTMAN.

At first, give it a shot with REST API Explorer, you won't feel the need of using POSTMAN at all.

find_real_file.png

 

Then use same request header and attach the file through postman. It should give you 201 status code.

 

find_real_file.png

 

Thanks

Gaurav