
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 02:32 AM - edited 11-29-2023 02:34 AM
Hello Team,
I have a question regarding passing dynamic parameters in a REST Message, specifically when pulling information from Azure Intune. The issue is that the Microsoft graph URI contains spaces, and when trying to use it in ServiceNow, the spaces need to be replaced with %20. For example:
Original URL:
```
https://graph.microsoft.com/v1.0/devices?$filter=deviceid eq '0bda714f-78f3-408b-8ebf-5ea165733ff5'
```
URL in ServiceNow:
```
https://graph.microsoft.com/v1.0/devices?$filter=deviceid%20eq%20'0bda714f-78f3-408b-8ebf-5ea165733f...'
```
While the above query works fine, the challenge arises when attempting to pass dynamic parameters. The parameter is populated as `deviceId='xxxxxxxxxx'` instead of `deviceId eq xxxxxxxxx`, causing the data pull to fail. How can this be addressed?
Ref Attachment for error.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 04:31 AM
You can define the end point like the one below.
https://graph.microsoft.com/v1.0/devices?$filter=deviceid%20eq%20'${id}'
Then click on the Auto Generate variables related link, so it will generate a variable "id" and you can dynamically pass the 0bda714f-78f3-408b-8ebf-5ea165733ff5 part from script like below.
var r = new sn_ws.RESTMessageV2('Service Graph Connector', 'Default GET');
r.setStringParameterNoEscape('id', '0bda714f-78f3-408b-8ebf-5ea165733ff5');
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 04:31 AM
You can define the end point like the one below.
https://graph.microsoft.com/v1.0/devices?$filter=deviceid%20eq%20'${id}'
Then click on the Auto Generate variables related link, so it will generate a variable "id" and you can dynamically pass the 0bda714f-78f3-408b-8ebf-5ea165733ff5 part from script like below.
var r = new sn_ws.RESTMessageV2('Service Graph Connector', 'Default GET');
r.setStringParameterNoEscape('id', '0bda714f-78f3-408b-8ebf-5ea165733ff5');
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 09:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 06:51 PM
@Chetan Mahajan I'm glad that it helped 👍
Anvesh