Result handling
All endpoints in Account API support 3 different result-handling options, which allow flexibility in how you receive the output of your requests, depending on your integration needs and the nature of the requests.
Long polling (default)
With long polling, the API does not respond until the requested result is ready. This option is suitable for requests involving small amounts of data or when a quick response is expected.
How to use
- Specify the
result-handling
header and set it tolong
. - If the
result-handling
header is not included,long
is used by default.
Response options
- Successful completion:
{
"status": "complete",
"completion": { ... }
}
{
"status": "error",
"error": {
"errorType": "invalidRequestBody",
"message": "The request body is invalid: {validation_details}."
}
}
Result link
With the result link option, the API accepts your request and immediately returns a link you can use to periodically check for the result.
How to use
- Set the
result-handling
header toreslink
.
Response options
- Accepted:
{
"status": "processing",
"process": {
"message": "Your request is being processed. Please check the resultLink periodically.",
"resultLink": "https://api.linkedapi.io/account/results/{someShortHash}"
}
}
{
"status": "error",
"error": {
"errorType": "invalidRequestBody",
"message": "The request body is invalid: {validation_details}."
}
}
Pulling the result
Use the resultLink
provided to make a GET request:
GET https://api.linkedapi.io/account/results/{someShortHash}
- Processing:
{
"status": "processing",
"process": {
"message": "Your request is being processed. Please check the resultLink later.",
"resultLink": "https://api.linkedapi.io/account/results/{someShortHash}"
}
}
- Successful completion:
{
"status": "complete",
"completion": { ... }
}
{
"status": "error",
"error": {
"errorType": "linkedinAccountSignedOut",
"message": "This LinkedIn account has been signed out in our cloud browser."
}
}
Webhook
With the webhook option, the API accepts your request and sends the result to a specified webhook URL as soon as it is ready. This method is ideal for real-time notifications and eliminates the need for periodic polling.
How to use
- Set the
result-handling
header tohook
. - Include a
webhook
header with the URL to which the result should be sent.
Response options
- Accepted:
{
"status": "processing",
"process": {
"message": "Your request is being processed. The result will be sent to the webhook.",
"webhook": "https://webhookexample.com/"
}
}
{
"status": "error",
"error": {
"errorType": "invalidRequestBody",
"message": "The request body is invalid: {validation_details}."
}
}
Webhook receives
- Successful completion:
{
"status": "complete",
"completion": { ... }
}
{
"status": "error",
"error": {
"errorType": "linkedinAccountSignedOut",
"message": "This LinkedIn account has been signed out in our cloud browser."
}
}
complete
) are shown. The actual request handling process always stays within the options described above.