Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

table name missing error in attachment rest API

Pushpendra1
Tera Contributor

I am working on a incident Servicenow-Servicenow ebonding. When i am trying to send the attachment from one instance to other i am getting error in the resonse code-"{"error":{"detail":null,"message":"Missing parameter: table_name"},"status":"failure"}"

I have written a BR on sys_attachment table-

Please find the REST message below-

7 REPLIES 7

Hitoshi Ozawa
Giga Sage
Giga Sage

In the header, are you specifying the "Content-Type" to be a binary file?

MrMuhammad
Giga Sage

update as below

request.setQueryParameter("table_name", "incident");
request.setQueryParameter("table_sys_id", <SYS ID HERE>);
request.setQueryParameter("file_name", name);
request.setRequestHeader("Content-Type", tokenID);
request.setRequestHeader("Accept", "application/json");
request.setRequestBodyFromAttachment(attach);
Regards,
Muhammad

mathieu_brule
Kilo Sage

Hi,

 

Some years later 🙂 , we faced the same issue, and below how we resolved it :

In the rest message, table_sys_id, file_name and table_name have to be set on query parameters, not in the body as shown in your screenshot.

Please have a look :

 

find_real_file.png

If it can help anyone 🙂