Request
Octory PRO
Element type: Dictionary
You can specify a request directly in the action or in the APIRequests as models, and then use them in the action.
Keys
Name | Type | Possible values | Required |
---|---|---|---|
Endpoint | String | - | |
Method | String | POST , GET , PUT , DELETE | |
Headers | Dictionary | - | |
Parameters | Dictionary | - | |
Body | Dictionary | - | |
ParentRequest | Dictionary or String | - | |
MDMApi | String | Jamf , JamfPro , Airwatch | |
VariableReadingPaths | Dictionary | - | |
Condition | Dictionary (Condition) | - |
Detail
Endpoint
Type: String
Explanation: Request endpoint URL. Is added to the base URL you can provide in the APIRequests section.
Method
Type: String
Possible values: POST
, GET
, PUT
, DELETE
Explanation: The HTTP method. Default is GET
.
Headers
Type: Dictionary
Explanation: Let you specify additional HTTP headers if required by the API
Parameters
Type: Dictionary
Explanation: Let you specify additional URL paramters if required by the API
Body
Type: Dictionary
Explanation: Key/Values pairs Data you want to send as the body of the request.
ParentRequest
Type: String
Explanation: The parent request whose fields are to be reused if the same fields in the request are not specified. If no field has to be modified, the parent request can be specified as a String, with the parent name for value.
MDMApi
Type: String
Possible values: Jamf
, JamfPro
, Airwatch
Explanation: MDM Api to target. This provide the heavy lifting to directly use those APIs
VariableReadingPaths
Type: Dictionary
Explanation: Allows you to specify a path in a received data object like computer->general->name and to associate a variable name that can then be used within Octory. Use [Index] to indicate that you want to target the value in an array at the index, and [#] to get a dictionary or an array count.
See more examples and explanations (the separator "->" is replaced by a point ".").
Condition
Type: Dictionary (Condition)
Explanation: Allows launch the action only based on a boolean expression.
Example
Retrieve the name of the computer with the id 20 from a Jamf MDM server, using the classic Jamf API.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>ActionSets</key>
<array>
<dict>
<key>Type</key>
<string>Parallel</string>
<key>Triggers</key>
<array>
<string>NextButtonClick</string>
</array>
<key>Actions</key>
<array>
<dict>
<key>Type</key>
<string>SendRequest</string>
<key>Request</key>
<dict>
<key>Endpoint</key>
<string>https://mycompany.jamfcloud.com/JSSResource/computers/id/20</string>
<key>Method</key>
<string>GET</string>
<key>MDMApi</key>
<string>Jamf</string>
<key>VariableReadingPaths</key>
<dict>
<key>ComputerName</key>
<string>computer->general->name</string>
</dict>
</dict>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>
The same request when you have specified a DefaultMDM
and the JamfBaseURL
keys in the APIRequests section.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>ActionSets</key>
<array>
<dict>
<key>Type</key>
<string>Parallel</string>
<key>Triggers</key>
<array>
<string>NextButtonClick</string>
</array>
<key>Actions</key>
<array>
<dict>
<key>Type</key>
<string>SendRequest</string>
<key>Request</key>
<dict>
<key>Endpoint</key>
<string>computers/id/20</string>
<key>VariableReadingPaths</key>
<dict>
<key>ComputerName</key>
<string>computer->general->name</string>
</dict>
</dict>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>
Retrieve first and second users in the users array and store their respective names in FirstUserName and SecondUserName.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>ActionSets</key>
<array>
<dict>
<key>Type</key>
<string>Parallel</string>
<key>Triggers</key>
<array>
<string>NextButtonClick</string>
</array>
<key>Actions</key>
<array>
<dict>
<key>Type</key>
<string>SendRequest</string>
<key>Request</key>
<dict>
<key>Endpoint</key>
<string>accounts</string>
<key>VariableReadingPaths</key>
<dict>
<key>FirstUserName</key>
<string>accounts->users->[0]->name</string>
<key>SecondUserName</key>
<string>accounts->users->[1]->name</string>
</dict>
</dict>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>
When defining request in the APIRequests as models, you can reuse them in an action. For example, if you have defined a “GetComputerName” request:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>ActionSets</key>
<array>
<dict>
<key>Type</key>
<string>Parallel</string>
<key>Triggers</key>
<array>
<string>NextButtonClick</string>
</array>
<key>Actions</key>
<array>
<dict>
<key>Type</key>
<string>SendRequest</string>
<key>Request</key>
<string>GetComputerName</string>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>
Retrieve the departments count and store it in the variable DepartmentsCount.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>ActionSets</key>
<array>
<dict>
<key>Type</key>
<string>Parallel</string>
<key>Triggers</key>
<array>
<string>NextButtonClick</string>
</array>
<key>Actions</key>
<array>
<dict>
<key>Type</key>
<string>SendRequest</string>
<key>Request</key>
<dict>
<key>Endpoint</key>
<string>departments</string>
<key>VariableReadingPaths</key>
<dict>
<key>DepartmentsCount</key>
<string>departments->[#]</string>
</dict>
</dict>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>
You can also override some keys of the parent request “GetComputerName”. Here, we are overriding the Endpoint key value of the parent request “GetComputerName”.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>ActionSets</key>
<array>
<dict>
<key>Type</key>
<string>Parallel</string>
<key>Triggers</key>
<array>
<string>NextButtonClick</string>
</array>
<key>Actions</key>
<array>
<dict>
<key>Type</key>
<string>SendRequest</string>
<key>Request</key>
<dict>
<key>ParentRequest</key>
<string>GetComputerName</string>
<key>Endpoint</key>
<string>computers/id/5</string>
</dict>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>