Notebook Actions

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

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

Delete

Deletes a notebook

Method And Url

DELETE https://api.losant.com/applications/APPLICATION_ID/notebooks/NOTEBOOK_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, notebook.*, or notebook.delete.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
NOTEBOOK_ID ID associated with the notebook 575ed78e7ae143cd83dc4aab

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/notebooks/NOTEBOOK_ID

Successful Responses

Code Type Description
200 Success If notebook was successfully deleted

Error Responses

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

Execute

Triggers the execution of a notebook

Method And Url

POST https://api.losant.com/applications/APPLICATION_ID/notebooks/NOTEBOOK_ID/execute

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, notebook.*, or notebook.execute.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
NOTEBOOK_ID ID associated with the notebook 575ed78e7ae143cd83dc4aab

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 Notebook Execution Options schema. For example, the following would be a valid body for this request:

{}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    -d '{}' \
    https://api.losant.com/applications/APPLICATION_ID/notebooks/NOTEBOOK_ID/execute

Successful Responses

Code Type Description
200 Success If execution request was accepted and successfully queued

Error Responses

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

Get

Retrieves information on a notebook

Method And Url

GET https://api.losant.com/applications/APPLICATION_ID/notebooks/NOTEBOOK_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, notebook.*, or notebook.get.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
NOTEBOOK_ID ID associated with the notebook 575ed78e7ae143cd83dc4aab

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/notebooks/NOTEBOOK_ID

Successful Responses

Code Type Description
200 Notebook notebook information

Error Responses

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

Logs

Retrieves information on notebook executions

Method And Url

GET https://api.losant.com/applications/APPLICATION_ID/notebooks/NOTEBOOK_ID/logs

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, notebook.*, or notebook.logs.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
NOTEBOOK_ID ID associated with the notebook 575ed78e7ae143cd83dc4aab

Request Query Parameters

Name Required Description Default Example
limit N Max log entries to return (ordered by time descending) 1 limit=10
since N Look for log entries since this time (ms since epoch) since=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/notebooks/NOTEBOOK_ID/logs

Successful Responses

Code Type Description
200 Notebook Execution Logs notebook execution information

Error Responses

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

Patch

Updates information about a notebook

Method And Url

PATCH https://api.losant.com/applications/APPLICATION_ID/notebooks/NOTEBOOK_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, notebook.*, or notebook.patch.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
NOTEBOOK_ID ID associated with the notebook 575ed78e7ae143cd83dc4aab

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 Notebook Patch schema. For example, the following would be a valid body for this request:

{
  "name": "New Notebook Name"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"name":"New Notebook Name"}' \
    https://api.losant.com/applications/APPLICATION_ID/notebooks/NOTEBOOK_ID

Successful Responses

Code Type Description
200 Notebook Updated notebook information

Error Responses

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

Request Input Data Export

Requests a combined zip file of the potential input data for a notebook execution

Method And Url

POST https://api.losant.com/applications/APPLICATION_ID/notebooks/NOTEBOOK_ID/requestInputDataExport

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, notebook.*, or notebook.requestInputDataExport.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
NOTEBOOK_ID ID associated with the notebook 575ed78e7ae143cd83dc4aab

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 Notebook Data Export Options schema. For example, the following would be a valid body for this request:

{
  "email": "user@example.com"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    -d '{"email":"user@example.com"}' \
    https://api.losant.com/applications/APPLICATION_ID/notebooks/NOTEBOOK_ID/requestInputDataExport

Successful Responses

Code Type Description
200 Success If export request was accepted and successfully queued

Error Responses

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

Upload

Uploads the jupyter notebook file

Method And Url

POST https://api.losant.com/applications/APPLICATION_ID/notebooks/NOTEBOOK_ID/upload

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, notebook.*, or notebook.upload.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
NOTEBOOK_ID ID associated with the notebook 575ed78e7ae143cd83dc4aab

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 a multipart form data post where jupyterFile is the jupyter notebook file.

Curl Example

curl -H 'Content-Type: multipart/form-data' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    -F jupyterFile=@localfilename' \
    https://api.losant.com/applications/APPLICATION_ID/notebooks/NOTEBOOK_ID/upload

Successful Responses

Code Type Description
200 Notebook Updated notebook information

Error Responses

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