The metadata object

The metadata object

Every entry in the metadata array must adhere to the following structure:

Name

Type

Description

name

string

The name of the property.

type

string

The type of the property. Must be one of [ "boolean", "number", "string", "object", "array" ].

subtype

string

Required only for entries of type array, used for future visualization purposes. Must be one of [ "boolean", "number", "string", "object" ].

visibility

string array

Whether the metadata object should be visible to the api, the dashboard, and/or worker. Defaults to [ "api" ].

value

The value of the property. The JSON type must match the type (and subtype) provided for the entry.

Examples

👍

Valid Metadata Examples

These valid metadata entries show the different types available:

{
    "name": "isOnfleetTrained",
    "type": "boolean",
    "value": true
}
{
    "name": "hourlyRate",
    "type": "number",
    "value": 27.33
}
{
    "name": "hometown",
    "type": "string",
    "value": "Tiburon, CA"
}
{
    "name": "load",
    "type": "object",
    "value": {
          "ambient": {
                "artichokes": 18,
            "strawberries": 23
        },
          "cold": {
                "strawberries": 52
          },
          "hot": {
            "apple-pie": 5
          }
    }
}
{
    "name": "paymentOptions",
    "type": "array",
    "subtype": "string",
    "value": [
        "visa",
        "mc",
        "amex",
        "btc"
    ]
}

❗️

Invalid Metadata Examples

The following metadata entries are invalid.

{
    "name": "lifetimeValue",
    "type": "number",
    "value": "3827.4"
}

Reason: value is expected as a number, however a string was provided.

{
    "name": "preferredDropoffLocations",
    "type": "array",
    "subtype": "string",
    "value": [
        "-122.42271423339842,37.7897092979573",
        "-122.46803283691405,37.76040136229719",
        -122.41550445556639,
        37.76420119453823
    ]
}

Reason: string subtype expects all array members to be of type string, however both string and number members were provided.