API Creation with the FlowEngine

This option allows you to create APIs with the power of FlowEngine functions.

To create an API from the FlowEngine, follow these steps:

  1. Select the option "My Digital Flows" from the Development menu:




  2. Select the domain and click the "View it" button:



  3. Look for the "onesaitplatform API" type nodes. You will see there are three different nodes:



  4. Drag a "onesaitplatform api rest" type node and double-click on it. The node's properties will appear and you can fill in the fields:

    1. Name: The name you will give to the API.
    2. Description: A detailed description for the API.
    3. Categories: Select one category in the drop-down list that the API can belong to.
    4. Is Public: This check box specifies whether the API will be public or not.



  5. Drag a "onesaitplatform api rest operation" type node, link it to the previous node, and double-click on it to edit its properties. Fill in the following fields:

    1. Method: Method of the REST API operation (GET | PUT | POST | DELETE).
    2. URL: Operation path.
    3. Name: Name you will give to the operation.
    4. Description: Detailed description of the operation.
    5. Query Params: JSON where each of the query params are declared, with their types.



      If you want to define path/query params, you can do it like this:
      1. Path params: They are defined in the path, with the ':' character preceding their names, for instance:


        and they can be recovered in the following node through msg.req.params.<parameter-name>:



      2. Query params: They are explicitly defined with a json specifying the parameter's name and type: 



        and they can be recovered in the following node through msg.req.query.<parameter-name>:



  6. For each operation, you must implement any needed logic. In this example, you can use "Function" nodes that will do the operations you deem neccessary.
  7. Once the needed logic is implemented, you must close each operation's flow with a response ("onesaitplatform api rest operation response" node). This node is in charge of returning both the response message body in "msg.payload" and a status code. This code will be 200 by default, but there are two ways to change it:

    1. writing the return code directly in the node,



    2. or making a previous node pass it in msg.statusCode



  8. Once you are happy with your operations on the API, click on the "Deploy" button for the changes to be saved in the platform:




  9. As with the other APIs that can be created in the platform, the definition is available through the API Manager. From there, you can test it from swagger.