08-11-2017 04:39 AM
I am trying to use REST GET snap to retrieve data from jive. However, they add a line “throw ‘allowillegalresourcecall is false.’;” in every response and therefore make the response not true JSON. REST GET snap is failing because of this.
I am looking for your expert help. Is there a way I can intercept the response and remove the first line before handing it back to the snap to process?
08-11-2017 04:58 AM
I haven’t used Jive, but this seems related to your query: https://community.jivesoftware.com/community/developer/blog/2015/06/29/throw-allowillegalresourcecal...
(Obviously the opposite value, but the examples provided may help)
08-25-2017 03:13 AM
Hello,
If you haven’t found a solution yet, please try this.
Within the REST Get snap there is a setting called “response entity type” you can switch this from default which is like an auto mode.
TEXT mode should give you the raw text of the response, and exempt it from the parsing giving you just a string of whatever your response is.
BINARY mode will return you a binary base64 string
For your problem I suggest using the TEXT option to get a raw string and then use SnapLogic expression language string manipulation functions to remove the line invalidating your json.
Once you have removed the invalid content, you can use the eval function to parse the json string into workable objects.
08-25-2017 02:37 PM
Note: There is a JSON.parse() method that would be safer to use than eval.