Introduction
In this article, you find everything you need about the mechanism of API request generation and data transfer through it.
Prerequisites
Before working with API requests, it is important to make sure that:
- The workflow is published in Orchestrator SaaS. You can learn more about publishing workflows here.
- Orchestrator SaaS has at least one Bot Runner connected. Learn more about connecting Bot Runner to Orchestrator here.
- At least one active Bot Runner is assigned to a workflow. Learn more about assigning Bot Runners to workflows here.
Sending an API request and transferring data through it
Testing requests using ElectroNeek API documentation
An API request can be tested using the tool available in our documentation or using external tools.
If you choose our API Documentation site to test a request, follow these instructions:
1. Navigate to the ElectroNeek API documentation portal.
2. Select a Request Type.
3. Click "Try it".
4. Select the "Target Server" information according to your organization region.
https://na.electroneek.com/account/home
where na
refers to North America.5. Click the Security field and enter your Authorization Credentials in the "Bearer Token" field. To find them, go to User Portal → Orchestrator SaaS → Integrations and click on "Generate Token" to obtain your API key.
6. Populate the path parameters. The Bot Runner ID is the only mandatory one.
7. Check "Send".
8. Check the result information displayed in the Response tab.
Testing requests using other tools
Another possible way to test a request is by using another tool. Look at the steps you need to follow if, for example, you use Postman.
Bearer Token method
To transfer data via an API request, you need the API request to trigger the execution of the algorithm. You can use the Bearer Token method, a straightforward and easy way to do it.
-
- Navigate to User Portal → SaaS Orchestrator → Workflows
- In the list of published algorithms, find the one you want and click on the line with its name to open detailed information.
- To the right of the algorithm name will be the "Copy ID" button. Click it - the algorithm ID will be copied to the clipboard.
- Тhat way, the URL of the API request should look like this:
https://api.na.electroneek.com/v1/orchestrator/workflow/61f3a4afc450b2375397f562/launch
- Go to Postman. Select the
POST
method and paste the URL to the input field. - Set the "Authorization" type as "Bearer Token" and insert the ID you copied.
- Press "Send". If everything is filled out correctly, the API request starts the bot. The system returns the following value (where
launch_id
corresponds with the ID of the workflow):
{
"launch_id": "62692aedaff0c8dd8ad8ab41"
}
API-Key method
The API request has this format:{{endpoint}}/workflow/{id}/launch
.
This code is composed of:
{{endpoint}}
—https://api.na.electroneek.com/v1/orchestrator
(if the region of the organization is North America){id}
—id
of the workflow to be launched.
So, open Postman and follow these steps:
- Create a new header in the "Headers" tab.
- Key -
Authorization
. - Value -
Api-Key {{API token}}
, for example:Api-Key B10uX4CJnsg9hoGhlsdsGbyeRKyAGkqF
.
- Key -
You can learn more about API tokens here.
Transferring data via API requests
To transfer data via an API request:
- Go to the "Body" section in Postman:
- In the
payload
parameter, enter the data to be transferred to Studio Pro.
Note: this data should have JSON format. - The
payload
data that is transferred and accepted by Studio Pro in thewebhook_data
variable.
Here's an example of transferring data to the bot:- Let's enter the message to be displayed in the user's notification to the
payload
parameter.
"payload": {
"notification": "Success!"
} - Then let's create a simple bot, containing only one activity — User notification.
- In the "Description message" parameter, select the "Calculate a value" option and enter the
webhook_data
variable and a parameter to be read:webhook_data.notification
- Launch the bot via an API request.
- If everything is done correctly, the result will be a notification with the message "Success!"
- Let's enter the message to be displayed in the user's notification to the