Rest json response find correlation id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 01:51 AM
Im creating incident to third party using POST REST. Then doing GET method to get number/sysid of that incident so I can set it as correlation id in my instance.
Using GET I'm getting response -
Transactions[
..
.
body{
Incident 1 In encrypted base 64
}
body{
Incident 2 In encrypted base 64
}
So on
How can I iterate through this response array and then decode it to set correlation id?
Please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 02:18 AM
so what's actually there in that base64
unless you share the actual json response body we cannot help
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 02:37 AM - edited 06-20-2023 02:38 AM
Hi Ankur, thanks for reply.
Base64 contains few fields of the incident created in third party such as incident state, created on, incident number and clientticket number (this is the field which shows incident i created in my instance and incident number is the field which i need to set as correlation id against this )
GET is providing me response such as
{
"status":"success",
"Message":"retrieved",
"responses":[{
activities:{
One:
Two:
Three:
},
headers {
One:
Two:
},
"body": "base64 encryption string containing fields mentioned in starting answer"
},
Similar fields again for 2nd incident
3rd incident and so on
This is all contained in single array "responses"
I'm able to get the response fields outside this array using gs.log but unable to get fields such as encrypted body which are present in array .. need help here.
I'm calling script include (containing GET REST) from scheduled job.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 02:43 AM
sorry but unless you share how the body looks at least for 1 incident it's difficult to understand.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 03:12 AM - edited 06-20-2023 05:05 AM
.