- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 03:14 AM
I am trying to do a get call via the Rest Messages for this endpoint : https://ocwen-sb.api.identitynow.com/beta/accounts?filters=sourceId eq "2c918084742b9e9a0174447f3d0d1821" and nativeIdentity eq "EXT100001"
However, when I try to run this, I get an error as "invalid URL".
Funny thing, this works well & good on the Postman. I searched a bit about this on google and got to know that apparently, some of these values need to be changes to ascii codes.
So I changed it to this : https://ocwen-sb.api.identitynow.com/beta/accounts?filters=(sourceId=2c918084742b9e9a0174447f3d0d1821&nativeIdentity=EXT100001)
Now I get "Method failed: (/beta/accounts) with code: 400"
{"detailCode":"400.1 Bad request content","trackingId":"7ed978c82e0540ebb13c9aec18c664ae","messages":[{"locale":"en-US","localeOrigin":"DEFAULT","text":"The request was syntactically correct but its content is semantically invalid."}]}
Couldn't find any solution. Need help.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 03:39 AM
I assume you must be setting the endpoint of the REST Message using setEndPoint()
please update as below
var sourceId = '2c918084742b9e9a0174447f3d0d1821';
var nativeIdentity = 'EXT100001';
var url = 'https://ocwen-sb.api.identitynow.com/beta/accounts?filters=(sourceId=' + sourceId + '&nativeIdentity=' + nativeIdentity + ')';
url = encodeURIComponent(url);
var request = new sn_ws.RESTMessageV2();
request.setEndpoint();
request.setHttpMethod('GET');
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 03:28 AM
Hi,
Have you tried to use encodeURIComponent?
var queryParam = 'sourceId eq "2c918084742b9e9a0174447f3d0d1821" and nativeIdentity eq "EXT100001"'
var uri = 'https://ocwen-sb.api.identitynow.com/beta/accounts?filters=' + encodeURIComponent(queryParam);
Something like the above.
Let me know if it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 03:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 03:39 AM
Hi Ketan,
If you are hardcoding the endpoint in that then use this directly
https://ocwen-sb.api.identitynow.com/beta/accounts?filters=(sourceId=2c918084742b9e9a0174447f3d0d1821&nativeIdentity=EXT100001)
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 03:43 AM
Tried this. Doesn't work. Method failed: (/beta/accounts) with code: 400 The request was syntactically correct but its content is semantically invalid.