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}]'

In the above example, this would be the response:

[
  {
    "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"
        ]
      }
    ]
  }
]

Complex types like object must match exactly to the fields in the entity, for an entity to be included in the query result set. The order of the members in the metadata query array is not taken into account, and the API will apply the AND logical operator to these.

While key order does not matter in metadata entries of type object, it does matter with those of type array provided.