- 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 04:46 AM
Hi,
please keep that endpoint as empty and set it via script 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:52 AM
I encoded this part - sourceId eq "2c918084742b9e9a0174447f3d0d1821" and nativeIdentity eq "EXT100001" via an online tool.
Append the encoded part to base URL to get the below. Try testing with this:
https://ocwen-sb.api.identitynow.com/beta/accounts?filters=sourceId%20eq%20%222c918084742b9e9a0174447f3d0d1821%22%20and%20nativeIdentity%20eq%20%22EXT100001%22
Thanks
- 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-20-2020 08:22 AM
Hope you are doing good.
Let me know if I have answered your question.
If so, please mark appropriate answer as correct & helpful to close the thread.
If not, please let us know if you need some more assistance.
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-21-2020 12:37 AM
Thanks Ankur. This helps.