Error message response on POST method - REST Ful webservice

raj159
Mega Expert

Hi,

I have a requirement to create CMDB records using REST call from 3rd party application.

When I am trying to create the record using 3rd party application I am able to insert the record but the status Showing as error.

Below is the JSON response I am getting:

{

"import_set": "ISET0011026"

"staging_table": "<Import set Table Name>"

"result": [1]

0:   {

"transform_map": "<Transform Map Name>"

"table": "cmdb_ci_appl"

"status": "error"

"error_message": "Target record not found"

"status_message": "No field values changed"

}

}

When I am trying to do the same on Request/Incident table it is giving the Incident/Request number.

Can some one please help me on this if I am missing something here.

Thanks!

Raj

1 ACCEPTED SOLUTION

I missed giving rest_service role for the import set table which I used here.




Now I am getting response with status inserted and sys_id.


View solution in original post

5 REPLIES 5

jose_valle
ServiceNow Employee
ServiceNow Employee

Hi Raj,



It looks like you are posting to an import staging table. Are you doing the same for the Request/Incident or are you posting directly to those tables?


Hi Jose,



Yes, I am posting to an import set staging table.



Its the same process I followed for Incident and request where I am getting response with Inc/Req numbers.



Thanks!



Raj


I missed giving rest_service role for the import set table which I used here.




Now I am getting response with status inserted and sys_id.


Hi @jose.valle,


Unfortunately I am currently experiencing the same issue described above by @raj159. 😞

I am using a POST method from a REST Message to create/update a given record.
When I run a test for that POST method using the 'Test' related link, the respective record is in fact created/updated with the proper values but, strangely the "result" I get from the Test Response includes the following:

"status":"error","error_message":"Target record not found",

even though the correct Import Set, Staging Table, Transform Map and Table are properly identified.

In fact, in the Import Set table itself, I can see that the following attribute values for the new entry representing the created/updated record via the POST method:

- "State = Updated';
- "Target Table" is correct;
- "Target record' is correct;
- "Error" is empty".

Any ideas on what might be happening here?

Thank you in advance! 🙂

 

Kind regards,

Fábio Gonçalves