Executing workflows
Since Account API is workflow-based, you need to execute workflows to perform automations. To do this, make a POST
request to the following endpoint:
POST https://api.linkedapi.io/account/workflow
In the request body, include a JSON that describes your workflow, for example:
{
"actionType": "st.checkConnectionStatus",
"personUrl": "https://www.linkedin.com/in/person1",
"label": "person1",
"then": { ... }
}
For details on how to build workflows, visit the building workflows page. Below we'll cover the possible API responses and result handling options.
Possible responses
The following responses are returned in different situations depending on your chosen result handling option (see below):
Completed
This response indicates that the workflow has been successfully executed. Note that a completed
status doesn't mean that individual actions within the workflow succeeded – specific actions might have failed, but the workflow itself was processed to completion.
{
"status": "completed",
"completion": { /* workflow completion result */ }
}
Running
This response indicates that the workflow is still in progress. You will only receive this status when using the result link or webhook result handling options.
For result link:
{
"status": "running",
"progress": {
"message": "Your workflow is running. Please check the resultLink periodically.",
"resultLink": "https://api.linkedapi.io/account/results/{someHash}"
}
}
For webhook:
{
"status": "running",
"progress": {
"message": "Your workflow is running. The result will be sent to the webhook.",
"webhook": "https://webhookexample.com/"
}
}
Failed
This response indicates that the workflow execution failed due to one of the global errors.
{
"status": "failed",
"error": {
"type": "invalidWorkflow",
"message": "Workflow configuration doesn't meet the constraints of one or more actions."
}
}
Result handling options
Account API supports 3 different result handling options, providing flexibility for different integration needs and workflow execution durations.
Long polling (default)
When you make a workflow execution request, the response is not returned immediately but only after the workflow finishes, with either completed
or failed
status.
How to use:
- Specify a
result-handling
header and set it tolong
. - If the
result-handling
header is not included,long
is used by default.
Result link
Returns an immediate response with either running
or failed
status. If running
, the response includes a result link that you need to periodically poll with GET
requests:
GET https://api.linkedapi.io/account/results/{someHash}
While the workflow is still executing, you'll continue to receive the running
status, but once it completes, you'll get either completed
or failed
.
How to use:
- Specify a
result-handling
header and set it toreslink
.
Webhook
Returns an immediate response with either running
or failed
status. Once the workflow finishes, the result with either completed
or failed
status will be sent to your specified webhook URL.
How to use:
- Specify a
result-handling
header and set it tohook
. - Include a
webhook
header with the URL to which the result should be sent.