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
API Info Tab
Use this tab to specify the basics of the REST call - endpoint, type and authentication info
- Call Type - We currently support GET, POST, PUT and DELETE calls. Select the one you need for this call.
- URL of REST Service - This is the URL or endpoint for the REST service you wish to call.
- Auth User Name - If the other service requires Basic Authentication you can enter the User Name here
- Auth Password - If the other service requires Basic Authentication you can enter the Password here
POST/PUT Data Tab
Use this tab to specify what data you are sending in your POST/PUT call.
- JSON - JSON data to send as a complete POST/PUT packet.
- Multi-Part Form Fields- You can also pass field/value pairs as multi-part form fields. Add an entry for each field.
Document Tab
You can use this to send a single Document in your REST call. The Document must be available by Id or by Record ID / Cat / SubCat / Name and must be less than 2 MB.
- Document ID - ID of the Document to send. If you choose to use the Document ID then the Record / Cat / SubCat / Name values are ignored.
- Record ID - ID of the Record containing the Document to send. If you choose to use the Record ID then you need to also specify Cat / SubCat / Name values to specify the Document to send.
- Send As - Off (the default), the Document is sent as one field of a multi-part form, named by Document Field Name. Turn it on to send the Document as the raw request body, so the body of the call is the Document's file and nothing else. The switch then reads Document will be sent as the raw request body. Use this for services that save whatever they receive as the file, such as uploading to OneDrive or SharePoint through Microsoft Graph with a PUT call. When it is on, the JSON and Multi-Part Form Fields on the POST/PUT Data tab are not sent. The Content-Type comes from a Content-Type header on the Headers tab if you add one; otherwise it is taken from the Document File Name (a name ending in .docx is sent as a Word document, for example).
- Document Field Name - The name of the multi-part form field the Document is sent in. It is hidden when Send As is set to the raw request body.
- Document File Name - The file name sent with the Document. When Send As is set to the raw request body and there is no Content-Type header, the file name's extension sets the Content-Type.
Headers
You can send multiple header values in your REST call. DO NOT use this to send Basic Auth header. That is done on the API Info tab. An Accept header added here is always sent as entered. Without one, DocMgt sends its own to match what the call sends. A Content-Type header is used only when Send As on the Document tab sends the Document as the raw request body; otherwise it is ignored, because DocMgt sets the Content-Type to match the JSON or multi-part form it sends.
- Header Name - Name of the header to send
- Header Value - Value of the header to send
Success Field Updates / Exception Field Updates
The response from the called REST endpoint will be available for you to store or process.
Failure Logging - If you turn OFF the action's "Stop on Error" setting (in the "Options" tab), you will see the "Exception Field Updates" tab in this action for allowing updates on REST call failure. This is useful when the failures from a REST call are expected. You can it to log the failure responses into the current Record just like with successful calls. Any response code from 200 to 299 is considered successful. Any response code outside of that range is considered a failure.
- 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
Response Code - This is the Response Code returned from the REST call. See this response code reference.
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 'FULLREST') then use PROP on that field.
[PROP([FULLREST]|0|show|name)]