Application Actions

https://api.losant.com/applications/APPLICATION_ID

Below are the various requests that can be performed against the Application resource, as well as the expected parameters and the potential responses.

Archive Data

Returns success when a job has been enqueued to archive this application's device data for a given day

Method And Url

GET https://api.losant.com/applications/APPLICATION_ID/archiveData

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Organization, all.User, application.*, or application.archiveData.

Request Path Components

Path Component Description Example
APPLICATION_ID ID of the associated application 575ec8687ae143cd83dc4a97

Request Query Parameters

Name Required Description Default Example
date Y The date to archive data (ms since epoch), it must be within the archive time range older than 31 days and newer than the organizations dataTTL 1518556791829

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/applications/APPLICATION_ID/archiveData?date=1518556791829

Successful Responses

Code Type Description
200 Success Enqueued a job to archive this applications device data

Error Responses

Code Type Description
400 Error Error if malformed request
404 Error Error if application was not found

Backfill Archive Data

Returns success when a job has been enqueued to backfill all current data to it's archive

Method And Url

GET https://api.losant.com/applications/APPLICATION_ID/backfillArchiveData

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Organization, all.User, application.*, or application.backfillArchiveData.

Request Path Components

Path Component Description Example
APPLICATION_ID ID of the associated application 575ec8687ae143cd83dc4a97

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/applications/APPLICATION_ID/backfillArchiveData

Successful Responses

Code Type Description
200 Success Enqueued a job to backfill device data to this application archive location

Error Responses

Code Type Description
400 Error Error if malformed request
404 Error Error if application was not found

Delete

Deletes an application

Method And Url

DELETE https://api.losant.com/applications/APPLICATION_ID

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Organization, all.User, application.*, or application.delete.

Request Path Components

Path Component Description Example
APPLICATION_ID ID of the associated application 575ec8687ae143cd83dc4a97

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X DELETE \
    https://api.losant.com/applications/APPLICATION_ID

Successful Responses

Code Type Description
200 Success If application was successfully deleted

Error Responses

Code Type Description
400 Error Error if malformed request
404 Error Error if application was not found

Get

Retrieves information on an application

Method And Url

GET https://api.losant.com/applications/APPLICATION_ID

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, application.*, or application.get.

Request Path Components

Path Component Description Example
APPLICATION_ID ID of the associated application 575ec8687ae143cd83dc4a97

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/applications/APPLICATION_ID

Successful Responses

Code Type Description
200 Application Application information

Error Responses

Code Type Description
400 Error Error if malformed request
404 Error Error if application was not found

Patch

Updates information about an application

Method And Url

PATCH https://api.losant.com/applications/APPLICATION_ID

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Organization, all.User, application.*, or application.patch.

Request Path Components

Path Component Description Example
APPLICATION_ID ID of the associated application 575ec8687ae143cd83dc4a97

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Request Body

The body of the request should be serialized JSON that validates against the Application Patch schema. For example, the following would be a valid body for this request:

{
  "name": "My Updated Application",
  "description": "Description of my updated application"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"name":"My Updated Application","description":"Description of my updated application"}' \
    https://api.losant.com/applications/APPLICATION_ID

Successful Responses

Code Type Description
200 Application Updated application information

Error Responses

Code Type Description
400 Error Error if malformed request
404 Error Error if application was not found

Payload Counts

Returns payload counts for the time range specified for this application

Method And Url

GET https://api.losant.com/applications/APPLICATION_ID/payloadCounts

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, application.*, or application.payloadCounts.

Request Path Components

Path Component Description Example
APPLICATION_ID ID of the associated application 575ec8687ae143cd83dc4a97

Request Query Parameters

Name Required Description Default Example
start N Start of range for payload count query (ms since epoch) -2592000000 0
end N End of range for payload count query (ms since epoch) 0 1465790400000

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/applications/APPLICATION_ID/payloadCounts

Successful Responses

Code Type Description
200 Payload Counts Payload counts, by type and source

Error Responses

Code Type Description
400 Error Error if malformed request
404 Error Error if application was not found