Export Incident Logs

This endpoint exports the history of an Incident by email.

Request

To export the Logs of an Incident please make a POST request to the following URL:

HTTP MethodURL
POSThttps://industrial.api.ubidots.com/api/v2.0/incidents/<incident_id>/logs/_/export/

Path Parameters

ParameterTypeDescription
incident_idStringThe id of the Incident. Incidents have no label, so the ~label form is not supported

Query Parameters

Any filter accepted by Get Incident Logs, e.g. ?type__in=comment,change_state. The export contains the same Logs, in the same order, that Get Incident Logs returns for the same query.

Body Parameters

ParameterTypeRequired?Default ValueDescription
export.formatStringNocsvFormat of the file: csv or jsonl
export.emailsString or String ArrayYesN/A (required)Recipients of the download link, as a list or a comma-separated string

Header

ParameterRequired?Description
X-Auth-TokenYesAuthentication Token of account
Content-TypeYesapplication/json
$ curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/incidents/<incident_id>/logs/_/export/?type__in=comment,change_state' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -H 'Content-Type: application/json' \
 -d '{
    "export": {
        "format": "csv",
        "emails": "[email protected]"
    }
}'
{
    "task": {
        "id": "7f1c2b9e-3a4d-4f5e-9b8c-1d2e3f4a5b6c"
    }
}
{
    "code": 400001,
    "message": "Validation Error.",
    "detail": {
        "export": {
            "format": [
                "\"xlsx\" is not a valid choice."
            ]
        }
    }
}
{
    "code": 401001,
    "message": "Authentication credentials were not provided.",
    "detail": "Authentication credentials were not provided."
}
{
    "code": 402001,
    "message": "Your current plan does not include Incidents feature."
}
{
    "detail": "You do not have permission to perform this action."
}
{
    "code": 404001,
    "message": "The request was not found."
}

Response

Returns 202 Accepted with the id of the export job. The job runs in the background and emails a download link to the recipients when the file is ready.

An unknown Incident returns 404 Not Found right away. If the Incident is deleted before the job runs, the job fails and no file is sent.