Me Actions

https://api.losant.com/me

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

Add Recent Item

Adds an item to a recent item list

Method And Url

POST https://api.losant.com/me/recentItems

Authentication

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

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

{
  "itemType": "device",
  "parentId": "575ec8687ae143cd83dc4a97",
  "itemId": "575ecf887ae143cd83dc4aa2"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    -d '{"itemType":"device","parentId":"575ec8687ae143cd83dc4a97","itemId":"575ecf887ae143cd83dc4aa2"}' \
    https://api.losant.com/me/recentItems

Successful Responses

Code Type Description
200 Recent Item List Updated recent item list

Error Responses

Code Type Description
400 Error Error if malformed request

Change Password

Changes the current user’s password and optionally logs out all other sessions

Method And Url

PATCH https://api.losant.com/me/changePassword

Authentication

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

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

{
  "newPassword": "yourNewPassword1!",
  "password": "yourCurrentPassword",
  "invalidateExistingTokens": true
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"newPassword":"yourNewPassword1!","password":"yourCurrentPassword","invalidateExistingTokens":true}' \
    https://api.losant.com/me/changePassword

Successful Responses

Code Type Description
200 Authenticated User A new, valid, auth token (potentially all previous tokens are now invalid)

Error Responses

Code Type Description
400 Error Error if malformed request

Delete

Deletes the current user

Method And Url

POST https://api.losant.com/me/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.User, me.*, or me.delete.

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

{
  "email": "email@example.com",
  "password": "this is the password"
}

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","password":"this is the password"}' \
    https://api.losant.com/me/delete

Successful Responses

Code Type Description
200 Success If the user was successfully deleted

Error Responses

Code Type Description
400 Error Error if malformed request

Disable Two Factor Auth

Disables two factor auth for the current user

Method And Url

PATCH https://api.losant.com/me/disableTwoFactorAuth

Authentication

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

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

{
  "twoFactorCode": "123123",
  "password": "this would be your password"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"twoFactorCode":"123123","password":"this would be your password"}' \
    https://api.losant.com/me/disableTwoFactorAuth

Successful Responses

Code Type Description
200 Me Updated user information

Error Responses

Code Type Description
400 Error Error if malformed request

Disconnect Github

Disconnects the user from Github

Method And Url

PATCH https://api.losant.com/me/disconnectGithub

Authentication

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

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 PATCH \
    https://api.losant.com/me/disconnectGithub

Successful Responses

Code Type Description
200 Me Updated user information

Error Responses

Code Type Description
400 Error Error if malformed request

Enable Two Factor Auth

Enables two factor auth for the current user

Method And Url

PATCH https://api.losant.com/me/enableTwoFactorAuth

Authentication

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

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

{
  "twoFactorAuthKey": "HBBGWJJVOVLXS4ZGNRTDOUKTMESFUR3BMRWVQND2HJYT44TOMVJA",
  "password": "this would be your password",
  "twoFactorCode": "012345"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"twoFactorAuthKey":"HBBGWJJVOVLXS4ZGNRTDOUKTMESFUR3BMRWVQND2HJYT44TOMVJA","password":"this would be your password","twoFactorCode":"012345"}' \
    https://api.losant.com/me/enableTwoFactorAuth

Successful Responses

Code Type Description
200 Me Updated user information

Error Responses

Code Type Description
400 Error Error if malformed request

Fetch Recent Items

Gets a recent item list

Method And Url

GET https://api.losant.com/me/recentItems

Authentication

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

Request Query Parameters

Name Required Description Default Example
parentId N Parent id of the recent list parentId=575ec8687ae143cd83dc4a97
itemType Y Item type to get the recent list of. Accepted values are: application, device, flow, dashboard, organization itemType=application

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/me/recentItems?itemType=application

Successful Responses

Code Type Description
200 Recent Item List Recent item list

Error Responses

Code Type Description
400 Error Error if malformed request

Generate Two Factor Auth

Returns the two factor auth key for a user

Method And Url

PATCH https://api.losant.com/me/generateTwoFactorAuth

Authentication

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

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 PATCH \
    https://api.losant.com/me/generateTwoFactorAuth

Successful Responses

Code Type Description
200 Two Factor Auth Info Updated user information

Error Responses

Code Type Description
400 Error Error if malformed request

Get

Retrieves information on the current user

Method And Url

GET https://api.losant.com/me

Authentication

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

Request Query Parameters

Name Required Description Default Example
includeRecent N Should the user include recent app/dashboard info includeRecent=true
summaryExclude N Comma-separated list of summary fields to exclude from user summary summaryExclude=payloadCount
summaryInclude N Comma-separated list of summary fields to include in user summary summaryInclude=payloadCount

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/me

Successful Responses

Code Type Description
200 Me Current user information

Error Responses

Code Type Description

Patch

Updates information about the current user

Method And Url

PATCH https://api.losant.com/me

Authentication

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

Request Query Parameters

Name Required Description Default Example
summaryExclude N Comma-separated list of summary fields to exclude from user summary summaryExclude=payloadCount
summaryInclude N Comma-separated list of summary fields to include in user summary summaryInclude=payloadCount

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

{
  "email": "email@example.com",
  "firstName": "Example",
  "lastName": "Name",
  "companyName": "Example, Inc.",
  "url": "https://example.com",
  "password": "My new password!!1"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"email":"email@example.com","firstName":"Example","lastName":"Name","companyName":"Example, Inc.","url":"https://example.com","password":"My new password!!1"}' \
    https://api.losant.com/me

Successful Responses

Code Type Description
200 Me Updated user information

Error Responses

Code Type Description
400 Error Error if malformed request

Payload Counts

Returns payload counts for the time range specified for all applications the current user owns

Method And Url

GET https://api.losant.com/me/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.User, all.User.read, me.*, or me.payloadCounts.

Request Query Parameters

Name Required Description Default Example
start N Start of range for payload count query (ms since epoch) start=0
end N End of range for payload count query (ms since epoch) end=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/me/payloadCounts

Successful Responses

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

Error Responses

Code Type Description
400 Error Error if malformed request

Refresh Token

Returns a new auth token based on the current auth token

Method And Url

GET https://api.losant.com/me/refreshToken

Authentication

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

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/me/refreshToken

Successful Responses

Code Type Description
200 Authenticated User Successful token regeneration

Error Responses

Code Type Description
400 Error Error if malformed request
401 Error Unauthorized error if authentication fails

Transfer Resources

Moves resources to a new owner

Method And Url

PATCH https://api.losant.com/me/transferResources

Authentication

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

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

{
  "destinationId": "575ed6e87ae143cd83dc4aa8",
  "destinationType": "organization",
  "applicationIds": [
    "575ec8687ae143cd83dc4a97"
  ]
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"destinationId":"575ed6e87ae143cd83dc4aa8","destinationType":"organization","applicationIds":["575ec8687ae143cd83dc4a97"]}' \
    https://api.losant.com/me/transferResources

Successful Responses

Code Type Description
200 Success If resource transfer was successful

Error Responses

Code Type Description
400 Error Error if malformed request

Verify Email

Sends an email verification to the user

Method And Url

POST https://api.losant.com/me/verify-email

Authentication

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

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/me/verify-email

Successful Responses

Code Type Description
200 Success If email verification was successfully sent

Error Responses

Code Type Description
400 Error Error if malformed request

Was this page helpful?


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