API Reference

Available queries

Location - Returns a single location based on the id provided

query {
  Location (id: 100012) {
    id
    label
    address {
      city
      country
    }
  }
}

Locations - Returns a list of locations based on the filter define

query {
  Locations {
    data {
    	id
    	label
    }
  }
}


Available fields

id - Int
Unique identifier of the location
label - String
Name of the location (ex: point of sales, warehouse, ...)
active - Boolean
If true, the location is active
deleted_at - Datetime
If the location is deleted, date of the deletion
backup_location - Location
If the location is deleted, location that replace this location
stock_transferred - Boolean
If the location is deleted, define if the stock is transfered to the backup location
address - Address
Address of the location


Filters

You can create filters based on following fields

label
Example:{ "column" : "LABEL", "operator" : "LIKE", "value" : "%warehouse%" }
active
Example :{ column": "active", "operator": "EQ", "value": true }

Sorting

You can sort data based on following fields : id, label, active

query Locations(
  $orderBy: [QueryLocationsOrderByOrderByClause!], 
  $first: Int = 50, 
  $page: Int
) {
  Locations(
    orderBy: $orderBy
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
    }
    data {
      id
      label
      address {
        label
      }
    }
  }
}
{
  "orderBy": [
    {
      "column": "LABEL",
      "order": "ASC"
    }
  ],
  "first": 50,
  "page": 1
}

Example of a query

query Locations(
  $where: QueryLocationsWhereWhereConditions, 
  $first: Int = 50, 
  $page: Int
) {
  Locations(
    where: $where
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
      count
      currentPage
      perPage
    }
    data {
      id
      label
      address {
        id
        label
        country
        address_1
        address_2
        postal_code
        city
        state
        phone
      }
      active
    }
  }
}
{
  "first": 50,
  "page": 1,
  "where": {
    "AND": [
      {
        "AND": [
          {
            "column": "STATUS",
            "operator": "EQ",
            "value": "active"
          }
        ]
      }
    ]
  }
}

Example of data returned

{
  "data": {
    "Locations": {
      "paginatorInfo": {
        "total": 11,
        "count": 11,
        "currentPage": 1,
        "perPage": 50
      },
      "data": [
        {
          "id": 100006,
          "label": "Point of sales (London)",
          "address": {
            "id": 100008,
            "label": "numquam",
            "country": "UK",
            "address_1": "609 Pablo Freeway Suite 486",
            "address_2": "Suite 486",
            "postal_code": "93393-8346",
            "city": "London",
            "state": null,
            "phone": "531-892-4740"
          },
          "active": true
        },
        {
          "id": 100000,
          "label": "Warehouse (Brussels)",
          "address": {
            "id": 100002,
            "label": "cupiditate",
            "country": "BE",
            "address_1": "683 Renner Key",
            "address_2": "Apt. 628",
            "postal_code": "95334",
            "city": "Brussels",
            "state": null,
            "phone": "380-558-1372"
          },
          "active": true
        }
      ]
    }
  }
}