- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2017 03:48 AM
Hello all,
I wanted to add an array of errors to the response of import set API by using response object (like response.errors = [])
It works fine for strings, but if I try to add an array, it returns:
{
"import_set": "ISET0031955",
"staging_table": "imp_create_request",
"result": [
{
"transform_map": "Imp Create Request",
"table": "u_catalog_request_via_api",
"status": "error",
"error_message": "'u_requested_for'='valery.bondarchik1@wolterskluwer.com': User record not found; Target record not found",
"errors": "org.mozilla.javascript.NativeArray@12432d1"
}
]
}
Am I out of luck?
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2017 05:11 AM
As long as it's a properly formatted JSON String they should be able to parse it. The ImportSetAPI is returning a string for errors, and I don't believe you can modify it.
On their end they'll just do the equivalent of...
var errorObj = new JSON().decode(response.errors);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2017 05:09 AM
I believe It would still remain object to them when they access it as JSON {}
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
json.encode(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2017 05:11 AM
As long as it's a properly formatted JSON String they should be able to parse it. The ImportSetAPI is returning a string for errors, and I don't believe you can modify it.
On their end they'll just do the equivalent of...
var errorObj = new JSON().decode(response.errors);