Search

Introduction

More Search-API information can be found here (for example inbound process): REST API documentation - Inbound Process

Some fulfillmenttools entities have their own search endpoint, located at: POST /api/{ENTITY-NAME}/search. Every fulfillmenttools entity defines which fields are queryable in its search endpoint.

  • Strings and numbers can be searched with the operators eq and notEq

  • Arrays of strings can be searched with in and notIn operators

  • The operators gt (>), gte (>=), lt (<) and lte (<=) are available for numbers and date values

  • For customAttributes the search is limited to key-value pairs in the searchTerms parameter

Example API calls

Searching for exact equal matches

Example: Search for stocks in facility with facilityRef d083f631-9f4c-463b-85d4-9414fb19239f.

POST https://{YOUR-TENANT-NAME}.fulfillmenttools.com/api/stocks/search
{
    "query": {
        "facilityRef": {
            "eq": "d083f631-9f4c-463b-85d4-9414fb19239f"
        }
    }
}

Searching with gt, gte, lt and lte operators

Example: Search for storage locations created before the 2nd October 2024.

POST https://{YOUR-TENANT-NAME}.fulfillmenttools.com/api/storagelocations/search
{
    "query": {
        "created": {
            "lt": "2024-10-02T14:43:21.257Z"
        }
    }
}

Sorting search results

POST https://{YOUR-TENANT-NAME}.fulfillmenttools.com/api/{ENTITY-NAME}/search
{
    "sortBy": "<attribute>_ASC",
    "query": {
      ...
    }
}

Adding a search result total count

The total count can significantly slow down the response time of the request.

POST https://{YOUR-TENANT-NAME}.fulfillmenttools.com/api/{ENTITY-NAME}/search
{
    "options": {
        "withTotal": true
    },
    "query": {
      ...
    }
}

Searching for several fields in conjunction with and/or

Example: Search for stocks in facility with facilityRef d083f631-9f4c-463b-85d4-9414fb19239f and that are placed on locations 6779689d-4852-4fcf-b13b-78f5ce4954d8 and 3b8be595-6a00-40cf-be09-12195e44eb99.

POST https://{YOUR-TENANT-NAME}.fulfillmenttools.com/api/stocks/search
{
    "query": {
        "and": [
            {
                "facilityRef": {
                    "eq": "d083f631-9f4c-463b-85d4-9414fb19239f"
                }
            }, {
                "locationRef": {
                    "in": [
                        "6779689d-4852-4fcf-b13b-78f5ce4954d8",
                        "3b8be595-6a00-40cf-be09-12195e44eb99"
                    ]
                }
            }
        ]
    }
}

Searching for nested fields

Example: Search for inboundProcesses with a purchaseOrder with ID 678ujnuzb67vg8h8oji.

POST https://{YOUR-TENANT-NAME}.fulfillmenttools.com/api/inboundprocesses/search
{
    "query": {
        "purchaseOrder": {
            "id": {
                "eq": "678ujnuzb67vg8h8oji"
            }
        }
    }
}

Searching for custom attributes

Fields in customAttributes can be made searchable by defining key-value pairs, which are then queryable in the search endpoints. The customAttributes can contain strings and numbers. For strings, the in and notIn operators are allowed. For numbers, the operatorslt, lte, gt, gte are additionally available.

It is important to use numbers when searching for a number attribute and strings when searching for a string attribute. Otherwise, the search will not give back the desired results. For example, if the search value is the number 5, a query search for eq: "5" would not be successful.

Example: Create a new storage locations with user-defined custom attributes that should be searchable and execute the search.

  1. Create a new entity with user-defined custom attributes that should be searchable (searchTerms)

POST https://{YOUR-TENANT-NAME}.fulfillmenttools.com/api/{facilityId}/storagelocations
...
"customAttributes": {
  "searchTerms": {       
    "TYPE": "FROZEN"     
  }
}
... 
  1. Construct a search query on custom attributes

POST https://{YOUR-TENANT-NAME}.fulfillmenttools.com/api/storagelocations/search
{
  "query": {
    "customAttributes": {
      "searchTerms": {
        "TYPE": {
          "eq": "FROZEN"
        }
      }
    }
  }
}

Last updated