This is not a full explanation about REST, much better resources for that already exists on the wider internet, and its history and approach can be found on Wikipedia here.
Here we will cover the important points for implementation in Rulevolution.
Rest interfaces can be implemented using the Rest Interface node. This node presents an end point that may be invoked by either a GET or POST call (other calls are possible, but uncommon).
Therefore you only need to create a model starting with this type of node, and allow your page to invoke this, a number of approaches are available, discussed lower down in this page.
To test that the Rest part of Rulevolution platform is up and running, you can use the following URL,
https://api.rulevolution.com/apiv1/ping
This can be used even from a browser (when a browser requests a page it is doing a GET type of REST call)
Note: high repeated use of this URL will invoke Denial of Service counter measures and get your IP addresses banned (up to once every few minutes is acceptable), should this occur to remove the ban you will need to contact our technical support.
This will response with a message of:
API Service is alive
The default production URL of any REST endpoint deployed is located at
https://api.rulevolution.com/apiv1/<your_path>
Your own domain name can also be used, this is an advanced topic, so if required in the first instance please raise a Support request.
Most browsers are now only allowed to invoke end-points that are in the same domain as the original domain from which the page was served, (this was introduced in all new browsers to reduce the ability for hacked pages to leak information to other 3rd parties). This means you cannot just call the IP address of the Rulevolution server.
One option is to allow a cross sight call by adding the appropriate header to your web page.
Another (better) way around this is to create a new DNS entry (usually created via your your ISP which will be running the name server for your domain) that points to the Rulevolution servers. As name servers are (almost always) independent of the web servers, and well protected, if you are able to make this change, then the browser can reasonably assume it is authorised to allow such a call.
In the Rest Interface node, you specify the domain that you wish this node to listen for.
So that a rogue Rulevolution user cannot imitate someone else, we require the placement of a file at a particular address to prove that you are authorised to deploy such a model on that domain. Further details can be covered by raising a Support request.
Other custom mechanisms can be deployed, if these are required please raise a Support request.
Parameters submitted to the rest interface should usually be in x-www-form-urlencoded form - this is the default for parameters submitted from a form, this can be changed in the property list of the REST node.
The value api-key MUST be defined, and must contain the users specific api-key (from the Users Profile)
All input parameters MUST have a name attribute, if not they will not be submitted to the server!
api-key must be submitted as a parameter, and must contain the users specific api-key (from the Users Profile)
apiv1 response codes:
Redirects
When posting from a form, it can be useful to redirect the user to a specific page depending the outcome of the call, for example a "success" page. This is supported by the passing of two optional variables, namely, on-success and on-error
These will only be actioned if the received REST message is form-urlencoded (application/x-www-form-urlencoded), this is the standard for submissions from browser based forms. - If neither are specified, then the raw JSON generated by the model will be returned. - A full list of HTML codes can be found here
The content of the response should be attached to a node (attached to the root) called Response, the graph attached will be converted to JSON and returned in the body of the response.
If there is no graph attached, the value of the response node will be set as the response body
If when the model exits, if the root node contains a value of "Error", then an error response will be returned