Skip to main content

Asset Type Management API

Version 1.1 — August 2024

Authentication - Login API

To access the GraphQL APIs, users must first authenticate using the Xemelgo Login REST API.

Endpoint Details

  • URL: https://rest.api.xemelgo.com/login
  • Method: POST

Properties

PropertyTypeDescriptionRequired
emailStringbase64 Encoded email id for userYes
passwordStringbase64 encoded password for userYes

Password needs to be a minimum of 8 characters and should have a number in it.

Request Body

{
"email": "base64_encoded_email",
"password": "base64_encoded_password"
}

StatusCode - 200 on success

Response Body

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

Use the $idToken as the authorization header for all API requests.

Errors

ErrorError codeException
In correct username and/or password400NotAuthorizedException

Create Asset Type API

Create Asset Type API allows to create the Asset Types for which the Assets will be created.

Endpoint Details

  • URL: https://api.xemelgo.com/graphql
  • Method: POST

Properties

PropertyTypeDescriptionRequired
idStringAsset Type unique identifierYes
numberStringAsset Type numberNo
nameStringAsset Type nameNo
descriptionStringAsset Type descriptionNo
quantityIntQuantity if applicableNo
unitStringUnit if applicableNo
imagePathStringPublic image URL for the Asset TypeNo
customPropertiesAWSJSONCustomer specific properties that are applicable for the Asset TypeNo

Headers

Authorization – $idToken

Request Body

mutation {
createAssetTypes(
input: {
inputList: [
{
id: "AssetType-1"
number: "AssetType-1"
name: "AssetType-1"
description: "test asset type"
quantity: 2
}
]
}
) {
assetTypeIds
}
}

Example Response

Response contains a list of all the Asset Type Ids.

{
"data": {
"createAssetTypes": {
"assetTypeIds": ["AssetType-1"]
}
}
}

Update Asset Types API

Update Asset Types API allows to update asset types at the same time.

Endpoint Details

  • URL: https://api.xemelgo.com/graphql
  • Method: POST

Properties

PropertyTypeDescriptionRequired
idStringThe unique id associated with the asset type. Usually referred as asset type number/SKU number of the product. If the asset type number is not unique, the id is usually a combination of multiple properties joined with "-" to make the id unique.Yes
numberStringAsset type numberNo
nameStringOptional property to describe the name of the asset type if there is oneNo
descriptionStringAsset type descriptionNo
quantityIntegerThe expected quantity of the asset typeNo
unitStringUnit of measure of the asset typeNo
imagePathStringImage URL of the asset type that can be used to display on the UINo
customPropertiesAWS/JSONAdditional properties that a customer may want to specify for the asset typeNo

Headers –
Authorization – $idToken

Request Body

Here is an example for payload for updating 2 asset types:

mutation {
updateAssetTypes(
input: {
inputList: [
{ id: "AssetType-1", number: "AssetType-1-X" }
{ id: "AssetType-2", number: "AssetType-2-X" }
]
}
) {
assetTypeIds
}
}

Status Code - 200

Response Body

{
"data": {
"updateAssetTypes": {
"assetTypeIds": ["AssetType-1", "AssetType-2"]
}
}
}

Response consists of a list of all asset type ids that were updated.

Errors

ErrorError codeException
Expired token401Unauthorized
Invalid token401Unauthorized
Missing Authorization Header401Unauthorized

For Expired Token

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "Token has expired."
}
]
}

For Invalid Token

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "Unable to parse JWT token"
}
]
}

Missing Authorization Header

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "User is not authorized to make this call."
}
]
}

Additional Errors

ErrorError code
Partial Update409

Partial Update (AssetType-2 is updated) but AssetType-3 is not found in the DB (therefore not updated)

{
"data": {
"updateAssetTypes": {
"assetTypeIds": ["AssetType-2"]
}
},
"errors": [
{
"path": ["updateAssetTypes"],
"data": null,
"errorType": null,
"errorInfo": null,
"locations": [
{
"line": 2,
"column": 5,
"sourceName": null
}
],
"message": "assetTypeId: AssetType-3 not found in DB"
}
]
}

List Asset Types API

List Asset Types API allows to retrieve all the asset types and view their details.

Endpoint Details

  • URL: https://api.xemelgo.com/graphql
  • Method: POST

Input Properties

PropertyTypeDescriptionRequired
filterStringFilter for propertiesNo
nextTokenStringPagination supportNo

Response Properties

PropertyTypeDescriptionRequired
assetTypesObjectList of asset types (view table below)Yes
nextTokenStringNext token to retrieve the next pageNo

assetTypes

PropertyTypeDescriptionRequired
idStringAsset Type identifierYes
nameStringAsset Type NameNo
numberStringAsset Type numberNo
descriptionStringAsset Type descriptionNo
quantityIntegerAsset Type quantityNo
unitStringUnit of measureNo
imagePathStringImage URL of the asset typeNo
customPropertiesAWSJSONOther properties for Asset typesNo

Headers –
Authorization – $idToken

Request Body

query assetTypes($filter: String, $nextToken: String) {
assetTypes(input: { filter: $filter, nextToken: $nextToken }) {
nextToken
assetTypes {
id
name
number
unit
description
quantity
imagePath
customProperties
}
}
}

Status Code - 200

Errors

ErrorError codeException
Expired token401Unauthorized
Invalid token401Unauthorized
Missing Authorization Header401Unauthorized

For Expired Token

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "Token has expired."
}
]
}

For Invalid Token

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "Unable to parse JWT token"
}
]
}

Missing Authorization Header

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "User is not authorized to make this call."
}
]
}

List Asset Types at Locations API

List Asset Types at Location API allows to retrieve all the asset types at the locations and view their statuses. List can be retrieved for any or all locations.

Endpoint Details

  • URL: https://api.xemelgo.com/graphql
  • Method: POST

Input Properties

PropertyTypeDescriptionRequired
filterStringFilter for propertiesNo
nextTokenStringPagination supportNo

Response Properties

PropertyTypeDescriptionRequired
assetTypesObjectList of assetTypes by location (view table below)Yes
nextTokenStringNext token to retrieve the next pageNo

assetTypes

PropertyTypeDescriptionRequired
typeObjectAsset Type details (view table below)Yes
missingCountNumberCount of missing assets of that asset type at the locationNo
dueSoonCountNumberCount of assets of that asset type that are due for maintenance soonNo
overdueCountNumberCount of assets of that asset type that are overdue for maintenanceNo
onhandCountNumberOn hand count of assets of that asset type at the locationNo
totalCountNumberTotal number of assets of that asset type at the locationNo
locationObjectLocation details (view table below)No

type

PropertyTypeDescriptionRequired
idStringAsset Type identifierYes
nameStringAsset Type NameNo
descriptionStringAsset Type descriptionNo
customPropertiesAWSJSONOther properties for Asset typesNo

location

PropertyTypeDescriptionRequired
idStringLocation identifierYes
nameStringLocation NameNo

Headers

Authorization – $idToken

Request Body

query assetTypeMetrics($filter: String, $nextToken: String) {
assetTypeMetrics(input: { filter: $filter, nextToken: $nextToken }) {
nextToken
assetTypes {
id
name
missingCount
dueSoonCount
overdueCount
onHandCount
totalCount
location {
id
name
}
type {
id
name
description
customProperties
}
}
}
}
----------------------------------------------------------------------
Filter input
{
"filter": "location.name == \"Location A\""
}

Status Code - 200

Errors

ErrorError codeException
Expired token401Unauthorized
Invalid token401Unauthorized
Missing Authorization Header401Unauthorized

Error Response Examples

Expired Token

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "Token has expired."
}
]
}

Invalid token

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "Unable to parse JWT token"
}
]
}

Missing Authorization Header

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "User is not authorized to make this call."
}
]
}

List Asset Types Count at Locations API

List Asset Types Count at Location API allows to retrieve all the counts of asset types at the locations. List can be retrieved for any or all locations.

Endpoint Details

  • URL: https://api.xemelgo.com/graphql
  • Method: POST

Input Properties

PropertyTypeDescriptionRequired
filterStringFilter for propertiesNo
nextTokenStringPagination supportNo

Response Properties

PropertyTypeDescriptionRequired
assetTypesObjectList of assetTypes by location (view table below)Yes
nextTokenStringNext token to retrieve the next pageNo

assetTypes

PropertyTypeDescriptionRequired
locationObjectLocation details (view table below)No
totalCountNumberTotal number of assets of that asset type at the locationNo

location

PropertyTypeDescriptionRequired
idStringLocation identifierYes
nameStringLocation NameNo

Headers

Authorization – $idToken

Request Body

query assetTypeLocationMetrics($filter: String, $nextToken: String) {
assetTypeLocationMetrics(input: { filter: $filter, nextToken: $nextToken }) {
nextToken
assetTypes {
totalCount
location {
id
name
}
}
}
}
----------------------------------------------------------------------
Filter input
{
"filter": "location.name == \"Location A\""
}

Status Code - 200

Errors

ErrorError codeException
Expired token401Unauthorized
Invalid token401Unauthorized
Missing Authorization Header401Unauthorized

Error Response Examples

Expired Token

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "Token has expired."
}
]
}

Invalid token

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "Unable to parse JWT token"
}
]
}

Missing Authorization Header

{
"errors": [
{
"errorType": "UnauthorizedException",
"message": "User is not authorized to make this call."
}
]
}