Locations

Retrieving all locations

get

Retrieves all locations assigned to the tenant. You can filter, sort and paginate the results with query parameters.


Required scopes

  • vendor.vendor_read

  • vendor.vendor_manage

Authorizations
Path parameters
tenantstring · min: 3 · max: 16Required

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

Pattern: ^[a-z][a-z0-9]+$
Query parameters
pageNumberinteger · min: 1Optional

The page number to be retrieved where the size of the pages must be specified by the pageSize parameter. The number of the first page is 1.

Default: 1
pageSizeinteger · min: 1Optional

The number of documents being retrieved on the page.

Default: 16
sortstringOptional

Fields to sort the response data by following order of the parameters from left to right. Can contain multiple fields in format: field name:sort direction separated by a comma. The colon with sort direction parameter is redundant and descending order is taken only if it is equal to desc or DESC. Ascending order is considered in any other case.

Example: name,metadata.createdAt:desc
qstringOptional

Query param for filtering entities by specified type. Examples of query params which are supported:

Q Param Description
name:"Exact match" find an entity with name field with Exact match value
name:~Supplier find an entity with name field containing Supplier value
type:COMPANY find an entity with type field with COMPANY value
metadata.createdAt:(>"2019-01-06T10:29:30.602Z" AND <"2020-01-07T10:29:30.602Z") find an entity with metadata.createdAt field with value between 2019-01-06T10:29:30.602Z and 2020-01-07T10:29:30.602Z
name:exists find an entity with existing name field
name:null find an entity with non-existing name field
Example: name:~supplier
fieldsstringOptional

Comma-separated list of fields to return in the response. If not specified, all fields are returned.

Example: name,type
namestringOptional

Location name. When specified, only locations containing the specified name will be returned.

typestring · enumOptional

The type of the location. When specified, only locations of the specified type will be returned.

Possible values:
contactDetails.emailstringOptional

The email of the contact details of the location. When specified, only locations with contact details containing the specified email will be returned.

contactDetails.phonestringOptional

The phone number of the contact details of the location.

contactDetails.addressstringOptional

The address of the contact details of the location.

contactDetails.citystringOptional

The city of the contact details of the location.

contactDetails.statestringOptional

The state of the contact details of the location.

contactDetails.postcodestringOptional

The postcode of the contact details of the location.

contactDetails.countryCodestringOptional

The country code of the contact details of the location.

Header parameters
X-Total-CountbooleanOptional

In order to get information how many entities meet a filter requirements, X-Total-Count header has been introduced. The header is optional and its default value is false. If the header is provided and it is true then total count is returned in the X-Total-Count response header.

Default: false
Responses
200
The request was successful. A list of locations is returned.
application/json
get
GET /vendor/{tenant}/locations HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
[
  {
    "id": "LOC001",
    "name": "Main HQ",
    "type": "HEADQUARTER",
    "contactDetails": {
      "emails": [
        "[email protected]"
      ],
      "phones": [
        "+1-555-0123"
      ],
      "addressLine1": "123 Industrial Rd",
      "city": "South Bend",
      "state": "Indiana",
      "postcode": "46619",
      "countryCode": "US",
      "tags": [
        "text"
      ]
    },
    "metadata": {
      "version": 1,
      "mixins": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      },
      "createdAt": "text",
      "modifiedAt": "text"
    },
    "mixins": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    }
  }
]

Creating a location

post

Creates a new location for the tenant. A location represents address information for a vendor.


Required scopes

  • vendor.vendor_manage

Authorizations
Path parameters
tenantstring · min: 3 · max: 16Required

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

Pattern: ^[a-z][a-z0-9]+$
Body
idstring · min: 1 · max: 66Optional

Custom location identifier. If not provided, it is automatically generated.

Pattern: ^[a-zA-Z0-9_-]+$
namestringOptional

The name of the location

typestring · enumRequired

The type of the location.

Possible values:
Responses
201
The request was successful. The location has been created.
application/json
post
POST /vendor/{tenant}/locations HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 303

{
  "name": "Main HQ",
  "type": "HEADQUARTER",
  "contactDetails": {
    "emails": [
      "[email protected]",
      "[email protected]"
    ],
    "phones": [
      "1234567890",
      "123456789"
    ],
    "addressLine1": "W Sample St",
    "addressLine2": "3601-3799",
    "city": "South Bend",
    "state": "Indiana",
    "postcode": "46619",
    "countryCode": "US",
    "tags": [
      "shipping"
    ]
  }
}
{
  "id": "53ac81fd0cce8b26b36f1234"
}

Retrieving a location

get

Retrieves a location by the specified unique identifier.


Required scopes

  • vendor.vendor_read

  • vendor.vendor_manage

Authorizations
Path parameters
tenantstring · min: 3 · max: 16Required

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

Pattern: ^[a-z][a-z0-9]+$
locationIdstringRequired

The location unique identifier.

Query parameters
fieldsstringOptional

Comma-separated list of fields to return in the response. If not specified, all fields are returned.

Example: name,type
Responses
200
The request was successful. The requested location is returned.
application/json
get
GET /vendor/{tenant}/locations/{locationId} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
{
  "id": "LOC001",
  "name": "Main HQ",
  "type": "HEADQUARTER",
  "contactDetails": {
    "emails": [
      "[email protected]"
    ],
    "phones": [
      "+1-555-0123"
    ],
    "addressLine1": "123 Industrial Rd",
    "city": "South Bend",
    "state": "Indiana",
    "postcode": "46619",
    "countryCode": "US",
    "tags": [
      "text"
    ]
  },
  "metadata": {
    "version": 1,
    "mixins": {
      "ANY_ADDITIONAL_PROPERTY": "anything"
    },
    "createdAt": "text",
    "modifiedAt": "text"
  },
  "mixins": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  }
}

Upserting a location

put

Updates or creates a location with a given location ID. You can omit the metadata.version, but then optimistic locking is not enabled.


Required scopes

  • vendor.vendor_manage

Authorizations
Path parameters
tenantstring · min: 3 · max: 16Required

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

Pattern: ^[a-z][a-z0-9]+$
locationIdstringRequired

The location unique identifier.

Body
namestringOptional

The name of the location.

typestring · enumRequired

The type of the location.

Possible values:
Responses
201
The request was successful. The location has been created.
application/json
put
PUT /vendor/{tenant}/locations/{locationId} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 333

{
  "name": "Main Warehouse",
  "type": "WAREHOUSE",
  "contactDetails": {
    "emails": [
      "[email protected]",
      "[email protected]"
    ],
    "phones": [
      "1234567890",
      "123456789"
    ],
    "addressLine1": "W Sample St",
    "addressLine2": "3601-3799",
    "city": "South Bend",
    "state": "Indiana",
    "postcode": "46619",
    "countryCode": "US",
    "tags": [
      "shipping"
    ]
  },
  "metadata": {
    "version": 1
  }
}
{
  "id": "53ac81fd0cce8b26b36f3492"
}

Delete a location

delete

Deletes a location.


Required scopes

  • vendor.vendor_manage

Authorizations
Path parameters
tenantstring · min: 3 · max: 16Required

The tenant that the caller is acting upon.

Please note that this value is always lowercase.

Pattern: ^[a-z][a-z0-9]+$
locationIdstringRequired

The location unique identifier.

Responses
204
The location has been deleted successfully.
delete
DELETE /vendor/{tenant}/locations/{locationId} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*

No content

Was this helpful?