Data Table Rows Actions

https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows

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

Delete

Delete rows from a data table

Method And Url

POST https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows/delete

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, dataTableRows.*, or dataTableRows.delete.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
DATATABLEID ID associated with the data table 575ed78e7ae143cd83dc4aab

Request Query Parameters

Name Required Description Default Example
limit N Limit number of rows to delete from data table 1000 limit=10

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

{
  "$or": [
    {
      "level": {
        "$ne": "myValue"
      }
    },
    {
      "level": 5
    }
  ]
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows/delete

Successful Responses

Code Type Description
200 Data Table Rows Delete If request successfully deletes a set of Data Table rows

Error Responses

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

Export

Request an export of the data table’s data

Method And Url

POST https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows/export

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, dataTableRows.*, or dataTableRows.export.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
DATATABLEID ID associated with the data table 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 Data Table Rows Export schema. For example, the following would be a valid body for this request:

{
  "email": "email@example.com",
  "query": {
    "$or": [
      {
        "myColumn1": {
          "$ne": "myValue"
        }
      },
      {
        "myColumn2": 5
      }
    ]
  },
  "queryOptions": {
    "limit": 10000
  }
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    -d '{"email":"email@example.com","query":{"$or":[{"myColumn1":{"$ne":"myValue"}},{"myColumn2":5}]},"queryOptions":{"limit":10000}}' \
    https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows/export

Successful Responses

Code Type Description
202 Job Enqueued API Result If request was successfully queued

Error Responses

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

Get

Returns the rows for a data table

Method And Url

GET https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows

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.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, dataTableRows.*, or dataTableRows.get.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
DATATABLEID ID associated with the data table 575ed78e7ae143cd83dc4aab

Request Query Parameters

Name Required Description Default Example
sortColumn N Column to sort the rows by sortColumn=myColumnName
sortDirection N Direction to sort the rows by. Accepted values are: asc, desc asc sortDirection=asc
limit N How many rows to return 1000 limit=0
offset N How many rows to skip 0 offset=0
includeFields N Comma-separated list of fields to include in resulting rows. When not provided, returns all fields. includeFields=id,createdAt

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/data-tables/DATA_TABLE_ID/rows

Successful Responses

Code Type Description
200 Data Table Rows Collection of data table rows

Error Responses

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

Post

Inserts a new row(s) into a data table

Method And Url

POST https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows

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, dataTableRows.*, or dataTableRows.post.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
DATATABLEID ID associated with the data table 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 Data Table Row Insert schema. For example, the following would be a valid body for this request:

{
  "myColumn1": "myValue"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    -d '{"myColumn1":"myValue"}' \
    https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows

Successful Responses

Code Type Description
201 Data Table Row Insert Result Successfully created data table row, or bulk insert count

Error Responses

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

Query

Queries for rows from a data table

Method And Url

POST https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows/query

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, dataTableRows.*, or dataTableRows.query.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
DATATABLEID ID associated with the data table 575ed78e7ae143cd83dc4aab

Request Query Parameters

Name Required Description Default Example
sortColumn N Column to sort the rows by sortColumn=myColumnName
sortDirection N Direction to sort the rows by. Accepted values are: asc, desc asc sortDirection=asc
limit N How many rows to return 1000 limit=0
offset N How many rows to skip 0 offset=0
includeFields N Comma-separated list of fields to include in resulting rows. When not provided, returns all fields. includeFields=id,createdAt

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

{
  "$or": [
    {
      "level": {
        "$ne": "myValue"
      }
    },
    {
      "level": 5
    }
  ]
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows/query

Successful Responses

Code Type Description
200 Data Table Rows Collection of data table rows

Error Responses

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

Truncate

Delete all data in the data table

Method And Url

POST https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows/truncate

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, dataTableRows.*, or dataTableRows.truncate.

Request Path Components

Path Component Description Example
APPLICATION_ID ID associated with the application 575ec8687ae143cd83dc4a97
DATATABLEID ID associated with the data table 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 POST \
    https://api.losant.com/applications/APPLICATION_ID/data-tables/DATA_TABLE_ID/rows/truncate

Successful Responses

Code Type Description
200 Success If request successfully deleted all rows in the data table, this will not send workflow data table deletion triggers

Error Responses

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

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.