Make REST Call
The Make REST Call action is used to call web-based systems that support REST interfaces
There are times when you need to communicate with other system in real time. USing this action you can make calls to other systems and return information back into the active Record. This action uses JSON REST commands so the other system must be able to support these calls. The detail in setting up the calls depends entirely on how the receiving system expects the call to be made and what information it is expecting.
Options
- URL of REST Service - This is the URL or endpoint for the REST service you wish to call.
- Call Type - We currently support GET, POST, PUT and DELETE calls. Select the one you need for this call.
- URL Encode - Whether or not you need to URL encode the values
- User Name for Service - If the other service requires Basic Authentication you can enter the User Name here
- Password for Service - If the other service requires Basic Authentication you can enter the Password here
- Data to Post/Put to REST Call - If you chose POST or PUT as the Call Type you will have this field. This field allows you to structure a JSON string to send as the POST body
- Variable Updates from REST Call - When data returns from the call you can map that return data into the active Records fields.
- Field Name - The name of the DocMgt field to store the returned data
- Source Type - Where to get the data to store
Full Response - This will store the entire JSON response into the field. This is useful if you wish to parse out the data at a later time.
Property - You can use the Source Name field to grab the correct property from the returned JSON
All Headers - This will store all the returned headers into the field. This is useful if you wish to parse out the data at a later time.
Header - You can use the Source Name field to grab the value of correct header from the returned header list
Collection Count - This allows you to store the count of returned data rather than the data itself. Use the Source Name field to specify which collection to count.
- Source Name - If you chose Property, Header or Collection Count you can specify the names of the items to operate on here
Property - If the returned item is an object then you would enter the property name here. If the return is a collection you would need to specify the collection offset and property using "(0).Name" notation. You can use as many levels as you need to get to your data. See the Property Example section below.
Header - Enter the name of the header whose value you wish to return.
Collection Count - If the returned item is a collection you could just leave this blank to get the count. If you need to get a count of a collection that is a property of an object you would need to specify the property name.
Property Example
If the returned data is a complex object you can use several layers of notation values to get to what you want.
Assume the following JSON is returned
[{"score":1.4265534,"show":{"id":722,"name":"The Golden Girls"}},{"score":0.7104603,"show":{"id":57291,"name":"The Holden Girls: Mandy & Myrtle"}}]
If you want to return the "name" property of the first "show" you would use this notation:
(0).show.name
Which will return
The Golden Girls
Explanation:
(0) - returns the first object in the returned array
show - returns the show object from the first object in the array
name - returns the name property from the show object
Alternative Approach to Property Notation
The alternative to the notation approach would be to use Full Response to get the entire JSON then use the [PROP()] variable to extract the data elements. Store the Full Response into a field (for example 'FULLRES') then use PROP on that field.
[PROP([FULLRES]|0|show|name)]