Querying metadata

Querying metadata

All supported entities have a /entityNamePluralized/metadata POST endpoint which you can use to retrieve a collection of entities that match one or more query metadata.

Here is an example of a destination metadata query request.

$ curl -X POST "https://onfleet.com/api/v2/destinations/metadata" \
       -u "cd3b3de84cc1ee040bf06512d233719c:" \
       -d '[{"name":"hasDog","type":"boolean","value":true}]'
[
  {
    "id": "aCbtgPsM*w7lAf61t4YqQODO",
    // ...
    "metadata": [
      {
        "name": "hasDog",
        "type": "boolean",
        "value": true,
        "visibility": [
          "api"
        ]
      }
    ]
  },
  {
    "id": "YI**76lT7nu053HRWHPVLhKW",
    // ...
    "tasks": [],
    "metadata": [
      {
        "name": "hasDog",
        "type": "boolean",
        "value": true,
        "visibility": [
          "api"
        ]
      }
    ]
  }
]

The order of the metadata query array members is not taken into account and the API will apply the AND logical operator to these, nevertheless, it is important that complex types like object be properly specified, as an exact match is strictly required for an entity to be included in the query result set. This implies that, while key order does not matter in metadata entries of type object, it does matter with those of type array; further, the object values must adhere to the exact JSON type which was originally provided.