Zorp Docs
Search
K
Comment on page

Rest API Action

REST API action is the used to integrate Zorp with any other system through REST API format.
This system could be your internal system or any 3rd party system.

Creating a REST API Action

Like other actions, REST API action can also be created from the workflow transition.
  1. 1.
    Select any transition
  2. 2.
    In the Actions block, click on Add Action
  3. 3.
    Select Rest API Action
  4. 4.
    Provide a suitable name for the REST API action
  5. 5.
    Choose the HTTP Methods (GET, POST, PUT, PATCH, DELETE)
  6. 6.
    Provide a valid http or https url
  7. 7.
    Any HTTP headers that should be passed along can be added in the Headers section
  8. 8.
    Payload or body can be added from the BODY tab
    • Only JSON format is accepted
    • Needs to be a valid JSON object
    • Body json can contain dynamic data field variables
    • You can also use the Low Code editor and programatically construct the payload for the REST API. Check more about this in Low Code Scripting
  9. 9.
    Configured REST API action can be instantly tested for correctness from Action Response tab
    • Along with testing the configured API, you can also add the response of the API to the mock data
    • Update mock data will come in handy while low code testing

Edit a REST API Action

Editing a REST API action is similar to creating a new one. Navigate to the specific transition and double-click on the action to edit.

Deleting a REST API Action

Deleting a REST API action can be done from action list of the transition

Import cURL

The "import curl" feature enables users to quickly and easily import a curl command and convert it into an API Action. This comes in handy when you want to integrate ZORP with an external system.

What is a cURL?

Curl is a command-line tool used to transfer data to or from a server, using various protocols such as HTTP, HTTPS, FTP, etc. It is often used to test APIs and send HTTP requests to servers. A curl command typically includes a URL, headers, a request method, and a body.

How does import cURL work?

The import curl feature allows users to copy and paste a curl command into our platform, and automatically imports the URL, headers, request method, and body. Once the curl command is imported, users can modify any of the imported fields to customize the API Action.

Step-by-Step Guide

To use the import curl feature, follow these steps:
  1. 1.
    Copy a curl command that you want to import.
  2. 2.
    Create a new automation or open the existing automation.
  3. 3.
    In the Automation click, "Add a Action" or "Add another Action" and select API Action in the right side.
  4. 4.
    Click on the "Import Curl" button.
  5. 5.
    Paste the copied curl command into the "Curl command" field.
  6. 6.
    Click on the "Import" button.
  7. 7.
    The imported URL, headers, request method, and body will be displayed in the appropriate fields.
  8. 8.
    Modify any of the fields as needed.
  9. 9.
    Click "Save" to create the new API Action.
Note: The import curl feature only supports curl commands that include a URL, headers, request method, and body. If the curl command includes other options, they will not be imported and will need to be manually added.

Examples

Suppose you have a curl command that looks like this:
1
curl -X POST https://api.example.com/users -H "Content-Type: application/json" -d '{"name": "John Doe", "email": "[email protected]"}'
To import this curl command into our platform, follow the steps outlined above. The imported URL will be "https://api.example.com/users", the imported request method will be "POST", the imported header will be "Content-Type: application/json", and the imported body will be '{"name": "John Doe", "email": "[email protected]"}'.