Note: This documentation refers to Gravio 3.8 or older. For Gravio 4 or newer, please refer to the respective documentation on doc.gravio.com . |
To trigger an action from a local Edge Server IP address please follow the below steps:
Preparation
Install Gravio Service and start it. Use Gravio Studio to create Actions to be executed.
API
- API Name:
run action api
- Protocol:
https (port 29443)
- Endpoint:
/runaction
- Argument: JSON document containing the
action id
and anyvariables
in this format:
{
"actionid": "16c3d181-8a05-4356-b7af-5b9a12965de4",
"variables": {"var1": "string", "var2": 1234}
}
The variables
get passed on into the Action as an action variable prefixed with av.
. Please ensure that you have also set up the Action in Gravio to accept the variables. Details on how to set that can be found under Variables in Actions :
Example
The actionid
as well as the variables
go into the JSON document. The response after execution is in green below. If an error occurs, the error content is returned. If the request was successful, the variables are available
REQUEST:
POST http://127.0.0.1:8282/action HTTP/1.1
Content-Length: 36
Content-Type: application/json; charset=utf-8 Host: 127.0.0.1:8282
Connection: Keep-Alive
Pragma: no-cache
{
"actionid": "16c3d181-8a05-4356-b7af-5b9a12965de4",
"variables": {"var2": 99999, "var1": "This is a value from the API."}
}
RESPONSE:
HTTP/1.1 200 OK
Content-Length: 9
Content-Type: application/json; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
Set-Cookie: __NCTRACE=7efbeeac-8e01-4dec-971d-87d1555b5a88; path=/; expires=Mon, 09- Apr-2018 07:10:42 GMT; HttpOnly
Date: Mon, 09 Apr 2018 06:40:42 GMT
“Success”
How to test the API
- We suggest using a tool called Postman to call the API. You can download Postman for free from https://www.getpostman
- Create a
POST
request - Enter the URL:
https://x.x.x.x:29443/runaction
- Pick method
raw
- Pick method
application/json
- In the Body, enter the
JSON
string for the action. You can retrieve the Action ID from the Actions overview page in Gravio Studio. - Create an action that can output the incoming variables, eg. to a Slack channel:
Troubleshooting
- Ensure that the receiving computer does not have any firewalls enabled.
- Ensure that both, Gravio Edge Server and Postman are in the same network.
- Ensure that the Gravio Service is running
- Ensure you are passing valid
JSON
- Ensure the variables are set up in the Gravio action
- Try restarting the Gravio Server