Last active
July 22, 2018 21:43
-
-
Save cmaggiulli/17835d9357ddf889a59fb7f23163caa7 to your computer and use it in GitHub Desktop.
Shell Script that uses curl to run a Oracle Service Cloud ROQL query. The call uses 18A version 1.4 /queryResults endpoint with a query parameter called "query". The ROQL statement returns the a file name and it's respective id, for all incidents containing an id. Usage instructions in comments. json_pp package needs to be installed on your linu…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Author: Chris Maggiulli | |
# Email: [email protected] | |
# Platform: Oracle Service Cloud (RightNow) Connect REST API v1.4 | |
# Description: Sends ROQL to a RESTful service to retrieve FileNames, FileIDs, and the IncidentID from a ReferenceNumber | |
# Usage: ./incident-file-information.sh {Usernmae} {Password} {BaseURL (without protocol schema)} {RefeenceNumber} | |
# Example: ./incident-file-information.sh CMaggu0 Lifer12 yoururl.custhelp.com/ 188011-0919 | |
ROQL="SELECT | |
Incidents.id AS IncidentID, | |
Incidents.FileAttachments.FileAttachmentList.id AS FileID, | |
Incidents.FileAttachments.FileAttachmentList.fileName As FileName | |
FROM | |
Incidents | |
WHERE | |
Incidents.FileAttachments.FileAttachmentList.id IS NOT NULL | |
AND | |
referenceNumber = '$4'" | |
curl -s \ | |
-H "Accept: application/json" \ | |
-H "OSvC-CREST-Application-Context: ABCD" \ | |
-u "$1:$2" \ | |
-G "https://$3/services/rest/connect/v1.4/queryResults" \ | |
--data-urlencode "query=$ROQL" | json_pp -f json -json_opt pretty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment