Create an API

Create your own API using RUAL

Create your own API

Besides making API calls you can also create your own API's. This API will have a preset url which will look like: To get your URI you can click on copy. This will copy the complete URI with your custom piece filled in the URI in-pin.

To create one of the API actions in the blueprint you need to go to the selector. Right click somewhere in the blueprint, select in the pop up menu selector. This will open either a menu on the right side of the screen, or when you have no actions yet in your blueprint in the middle of your screen. In this menu search for one of the API register action and select one.


Tip for starting a new API

The creation of an API in RUAL, is not that hard once you know how to. However, there might be moments where you get an error and it does not make sense why. That is why we wrote down some of the errors you might get while making your first API.
Cannot GET this might be the one everyone gets. One of the main reasons you can get this error is either your blueprint is not activated, or you need to deactivate and reactivate your blueprint, this will reactivate the API, and might resolve this error.


When you create a GET API, the only out-pin that will be created is the Connection pin. Just like the other API types is the connection pin the one you use for your replies, the query fields, the parameters, etc. To see what you can do with the connection pin you can pull out the search from it and look around what action uses the connection.

For an example we created a blueprint with a GET API. This api can also be used. The API Link. In the API URI you can add a query with data to pass on to the API. When you add a query to your URI, add it at the end of the URI, it should look something like: ?firstname=VALUE_OF_FIELD.



Just like the GET API, has the POST API also a Connections pin. It also has a Body pin. With this you can get the fields that has been given to the API. In the same blueprint as the GET API you can find the POST API with a test page you can use the see how the API is being used.


The Reply in ...

To finish of the API request you need to give a response to the API. You can reply in a number of ways: text, JSON, JSONP, file, xml.
Once you selected your reply type, you can create the message you want to return. In the reply in JSON example to the right, we selected the object type for the JSON. In the object you can fill with any field with value you want te reply with.

Every reply needs a code, this is the HTTP Status Code. You can find what codes when to use on the internet. The basics are: for a correct response you use 200, and for an error most of the times you use 404.

The type of respons can also be set, the default value will be different for each reply in .. type. To see the default you can click on the pin. To overwrite the headers you can add an array of objects that looks like: [{key: key, value: value}]