Skip to main content

Item Type Management API

Version 1.7 — April 2025

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 Item Types API

Create Inventory Parts API allows to create multiple inventory parts at the same time.

Endpoint Details

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

Properties

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

Headers –
Authorization – $idToken

Request Body

Here is an example for payload for creating 3 inventory parts with customProperties:

mutation {
createInventoryParts(
input: {
inputList: [
{
id: "STTC-125-PK-1"
number: "STTC-125"
unit: "PC"
quantity: 1
customProperties: "{\"color_ts\":\"Red\"}"
}
{
id: "STTC-126-PK-1"
number: "STTC-126"
unit: "BX"
quantity: 1
customProperties: "{\"color_ts\":\"Blue\"}"
}
{
id: "STTC-127-PK-1"
number: "STTC-127"
unit: "PC"
quantity: 6
customProperties: "{\"color_ts\":\"Yellow\"}"
}
]
}
) {
partIds
}
}

Status Code - 200

Response Body

{
"data": {
"createInventoryParts": {
"partIds": ["STTC-125-PK-1", "STTC-126-PK-1", "STTC-127-PK-1"]
}
}
}

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
Duplicate part ids in payload400
Inventory Part ids already exists409

Duplicate part ids in payload

{
"data": {
"createInventoryParts": null
},
"errors": [
{
"path": ["createInventoryParts"],
"data": null,
"errorType": "PayloadValidationError",
"errorInfo": null,
"locations": [
{
"line": 2,
"column": 5,
"sourceName": null
}
],
"message": "Duplicates in id values: [STTC-125-PK-1]. The values must be unique."
}
]
}

Inventory Part ids already exist

{
"data": {
"createInventoryParts": {
"partIds": []
}
},
"errors": [
{
"path": ["createInventoryParts"],
"data": null,
"errorType": "Error",
"errorInfo": {
"ids": ["STTC-125-PK-1", "STTC-126-PK-1", "STTC-127-PK-1"]
},
"locations": [
{
"line": 2,
"column": 5,
"sourceName": null
}
],
"message": "[BadRequest] Node creation for ItemType violates uniqueness constraint for fields: identifier, class. Status: 409"
}
]
}

Update Item Types API

Update Inventory Parts API allows to create update inventory parts at the same time.

Endpoint Details

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

Properties

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

Headers –
Authorization – $idToken

Request Body

Here is an example for payload for updating 2 inventory parts:

mutation {
updateInventoryParts(
input: {
inputList: [
{ id: "STTC-125-PK-1", number: "STTC-125-X" }
{ id: "STTC-126-PK-1", number: "STTC-126-X" }
]
}
) {
partIds
}
}

Status Code - 200

Response Body

{
"data": {
"updateInventoryParts": {
"partIds": ["STTC-125-PK-1", "STTC-126-PK-1"]
}
}
}

Response consists of a list of all part 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 (STTC-126-PK-1 is updated) but STTC-125-PK-2 is not found in the DB (therefore not updated)

{
"data": {
"updateInventoryParts": {
"partIds": ["STTC-126-PK-1"]
}
},
"errors": [
{
"path": ["updateInventoryParts"],
"data": null,
"errorType": null,
"errorInfo": null,
"locations": [
{
"line": 2,
"column": 5,
"sourceName": null
}
],
"message": "partId: STTC-125-PK-2 not found in DB"
}
]
}

List Item Types API

List Item Types API allows to retrieve all the item 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
inventoryPartsObjectList of item types (view table below)Yes
nextTokenStringNext token to retrieve the next pageNo

inventoryParts

PropertyTypeDescriptionRequired
idStringItem Type identifierYes
nameStringItem Type NameNo
numberStringItem Type numberNo
descriptionStringItem Type descriptionNo
quantityIntegerItem Type quantityNo
unitStringUnit of measureNo
imagePathStringImage URL of the item typeNo
customPropertiesAWSJSONOther properties for Item typesNo

Headers –
Authorization – $idToken

Request Body

query inventoryParts($filter: String, $nextToken: String) {
inventoryParts(input: { filter: $filter, nextToken: $nextToken }) {
nextToken
inventoryParts {
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 Item Types at Locations API

List Item Types at Location API allows to retrieve all the item 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
inventoryPartsObjectList of item types by location (view table below)Yes
nextTokenStringNext token to retrieve the next pageNo

inventoryParts

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

type

PropertyTypeDescriptionRequired
idStringItem Type identifierYes
nameStringItem Type NameNo
descriptionStringItem Type descriptionNo
customPropertiesAWSJSONOther properties for Item typesNo

location

PropertyTypeDescriptionRequired
idStringLocation identifierYes
nameStringLocation NameNo

Headers –
Authorization – $idToken

Request Body

query inventoryPartMetrics($filter: String, $nextToken: String) {
inventoryPartMetrics(input: { filter: $filter, nextToken: $nextToken }) {
nextToken
inventoryParts {
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 Item Types Counts API

List Inventory Parts Count at Location API allows to retrieve all the counts of inventory parts 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
inventoryPartsObjectList of inventoryParts count by location (view table below)Yes
nextTokenStringNext token to retrieve the next pageNo

inventoryParts

PropertyTypeDescriptionRequired
locationObjectLocation details (view table below)No
totalCountNumberTotal number of items of that inventory part at the locationNo
customerOnHandCountNumberTotal on-hand number of items of that inventory part at the locationNo

location

PropertyTypeDescriptionRequired
idStringLocation identifierYes
nameStringLocation nameNo

Headers –
Authorization – $idToken

Request Body

query inventoryPartLocationMetrics($filter: String, $nextToken: String) {
inventoryPartLocationMetrics(
input: { filter: $filter, nextToken: $nextToken }
) {
nextToken
inventoryParts {
totalCount
customerOnHandCount
location {
id
name
}
}
}
}

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."
}
]
}