Asset Tracking

Modified on Fri, 21 Feb at 2:55 PM

TABLE OF CONTENTS

Release Versions


VersionDescriptionAuthorRelease Date
1.0Get Asset route APIRenuka Agrawal9/9/2024


API


Xemelgo APIs are primarily GRAPH QL APIs


Login API


To access the Graph QL APIs users need to first access the Xemelgo login REST API to authenticate their credentials and then use the token to access the Graph QL APIs.


Rest API


Properties


PropertyTypeDescriptionRequired
email
Stringbase64 Encoded email id for userYes
passwordStringbase64 encoded password for user

password needs to be a minimum of 8 characters and should have a number in it
Yes


Request Body

{
  "email": String,
  "password": String
}

StatusCode - 200 on success


Response Body

{
  "AccessToken": $accessToken,
  "ExpiresIn": $expiresIn,
  "TokenType": "Bearer",
  "RefreshToken": $refreshToken,
  "IdToken": $idToken
}


Use the $idToken as the authorization header to make any subsequent API request.


Errors


ErrorError CodeException
Incorrect username and or password400NotAuthorizedException


Get Asset Route API


List Assets API allows to retrieve all the assets and view their statuses. It also allows to filter the list of APIs based on different properties


Graph API



Input Properties


PropertyTypeDescriptionRequired
idStringAsset NumberYes
startDateAWSTimestampStart date for routeNo
endDateAWSTimestampEnd date for routeNo


Response Properties


PropertyTypeDescriptionRequired
stateStringCurrent State of Asset at location i.e. unhand, removedYes
startDateAWSTimestampFirst detection timestamp at that locationNo
endDateAWSTimestampLast detection timestamp at that locationNo
locationObjectLocation at which the asset was last seen at (view table below)No
durationNumberTime spent at that locationNo


Location


PropertyTypeDescriptionRequired
idStringLocation identifierYes
nameStringLocation NameNo


Headers


HeaderValueNotes
Authorization$accessTokenUse the acessToken from the response of the Login API


Request Body

query assetRoute($id: String!, $startDate: AWSTimestamp, $endDate: AWSTimestamp, $nextToken: String) {
  assetRoute(input: { id: $id, startDate: $startDate, endDate: $endDate, nextToken: $nextToken }) {
    route {
      location {
        id
        name
      }
      state
      startDate
      endDate
      duration
    }
  }
}

Response Body

{
  "data": {
    "assetRoute": {
      "route": [
        {
          "location": {
            "id": "LU3000EX",
            "name": "LU3000EX"
          },
          "state": "onhand",
          "startDate": 1719864278922,
          "endDate": 1719864496290,
          "duration": 217368
        },
        {
          "location": {
            "id": "Server Room",
            "name": "Server Room"
          },
          "state": "onhand",
          "startDate": 1719864496290,
          "endDate": 1719864827571,
          "duration": 331281
        },
        {
          "location": {
            "id": "LU3000EX",
            "name": "LU3000EX"
          },
          "state": "onhand",
          "startDate": 1719864827571,
          "endDate": 1719866988210,
          "duration": 2160639
        },
        {
          "location": {
            "id": "Office",
            "name": "Office"
          },
          "state": "onhand",
          "startDate": 1719866988210,
          "endDate": 1719867246015,
          "duration": 257805
        },
        {
          "location": {
            "id": "LU3000EX",
            "name": "LU3000EX"
          },
          "state": "onhand",
          "startDate": 1719867246015,
          "endDate": 1719867531089,
          "duration": 285074
        },
        {
          "location": {
            "id": "Server Room",
            "name": "Server Room"
          },
          "state": "onhand",
          "startDate": 1719867531089,
          "endDate": 1719867581293,
          "duration": 50204
        },
        {
          "location": {
            "id": "Office",
            "name": "Office"
          },
          "state": "onhand",
          "startDate": 1719867581293,
          "endDate": 1719867614996,
          "duration": 33703
        },
        {
          "location": {
            "id": "LU3000EX",
            "name": "LU3000EX"
          },
          "state": "onhand",
          "startDate": 1719867614996,
          "endDate": null,
          "duration": 3122990
        }
      ]
    }
  }
}

Errors


ErrorError CodeError TypeError Category
Expired Token401UnauthorizedExceptionAuthorization Error
Invalid Token401UnauthorizedExceptionAuthorization Error
Missing Authorization Header401UnauthorizedExceptionAuthorization Error


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article