Attachment Rest API to Uploads a specified binary file as an attachment to a change request table

mshetty794
Kilo Contributor

I am trying to post a binary file as an attachment to a change request table using user who has itil role permission, On Post Api call from postman I am getting below error 

https://<instance >/api/now/attachment/file?table_name=change&table_sys_id=eb54c83a2f526010f48ed3f62799b638&file_name=test

Post API

 

Response

{
"error": {
"detail": "User is unauthorized to write to table: change",
"message": "User not authorized"
},
"status": "failure"
}
 
Can you help me what additional role need to be assigned. Currently user is assigned with itil role.
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@mshetty794 

ensure that user has table level WRITE ACCESS to change_request table

Then only the attachment can be added

also noted the table name is incorrect

https://<instance >/api/now/attachment/file?table_name=change_request&table_sys_id=eb54c83a2f526010f48ed3f62799b638&file_name=test

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@mshetty794 

example here on how to post binary file to ServiceNow

POST binary file to ticket ServiceNow REST API - Remove boundary and Content-Type

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@mshetty794 

ensure that user has table level WRITE ACCESS to change_request table

Then only the attachment can be added

also noted the table name is incorrect

https://<instance >/api/now/attachment/file?table_name=change_request&table_sys_id=eb54c83a2f526010f48ed3f62799b638&file_name=test

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader