Product management
ReferenceProduct management

metadata query

Retrieves all supported values for fields that can be set on a unit and unit space, such as

  • Locale codes
  • Text keys
  • Amenity names and values

Use this helper query to retrieve this data before issuing mutations to ensure you are specifying supported values. It is provided to help you understand what's available as you develop mutations to create and update properties.

Reading amenity metadata

As described above, you can use the metadata query to retrieve all supported values for various unit and space details. While most metadata is easy to read, such as locales and undefined that both provide key values you can simply pass into mutations, amenity metadata is complex. This section is provided to help you understand how to read it so that you can define amenities at any level. The code examples in this section show unit-level amenities, but you can apply your learnings to space-level amenities as well.

Here is the query request to retrieve unit-level amenities:

1query {
2 metadata {
3 property {
4 units {
5 amenities {
6 fieldsRequired
7 key
8 value {
9 fields {
10 key
11 required
12 type
13 typeDetails {
14 ... on AmenityFieldEnumTypeDetails {
15 multipleValuesAllowed
16 enumTypeValues: values
17 }
18 ... on AmenityFieldFeeTypeDetails {
19 feeTypeValues: values
20 }
21 }
22 }
23 }
24 }
25 }
26 }
27 }
28}

Here is an excerpt from the query's response, which shows the housekeeping amenity:

1{
2 "fieldsRequired": true,
3 "key": "housekeeping",
4 "value": {
5 "fields": [
6 {
7 "key": "frequency",
8 "required": false,
9 "type": "enum",
10 "typeDetails": {
11 "multipleValuesAllowed": false,
12 "enumTypeValues": [
13 "ON_REQUEST",
14 "DAILY",
15 "WEEKLY",
16 "ONCE"
17 ]
18 }
19 },
20 {
21 "key": "availability",
22 "required": false,
23 "type": "enum",
24 "typeDetails": {
25 "multipleValuesAllowed": true,
26 "enumTypeValues": [
27 "LIMITED",
28 "WEEKENDS",
29 "WEEKDAYS"
30 ]
31 }
32 }
33 ]
34 }
35}

Here’s an explanation of this metadata:

  • fieldsRequired – When true, indicates that at least one field must be specified to save the amenity to the property, unit, or space. When false, no fields are required to save the amenity. In the example above, fieldsRequired is true so either the frequency field or availability key must be set to save this amenity to the unit.

  • required – Indicates whether the key must be specified (or whether it’s optional). If fieldsRequired is true but none of the individual fields is required, any one of the fields must be specified but no individual one is required. In the example above, both fields are optional, so you can set either one.

  • type – Indicates the key’s type:

    • enum – Enumeration, allowed values provided by the enumTypeDetailsValues object; the multipleValuesAllowed field indicates whether more than one enumeration value can be specified
    • trilean - Values include true, false, or null
    • undefined – Free text
    • fee – Enumeration, allowed values provided by the feeTypeDetailsValues object
    • int – Integer value
    • decimal – Decimal value

For example, to set the frequency field for the amenity in this example, specify one of the enumeration values (because multipleValuesAllowed is false):

Mutation examples based on metadata

These examples demonstrate how to read metadata for an amenity and then set it. Code snippets are provided instead of full request and responses, for brevity.

  • Amenity with fields required

    1{
    2 "fieldsRequired": true,
    3 "key": "boat",
    4 "value": {
    5 "fields": [
    6 {
    7 "key": "type",
    8 "required": true,
    9 "type": "enum",
    10 "typeDetails": {
    11 "multipleValuesAllowed": true,
    12 "enumTypeValues": [
    13 "BOAT",
    14 "KAYAK"
    15 ]
    16 }
    17 },
    18 {
    19 "key": "boat-description",
    20 "required": false,
    21 "type": "text",
    22 "typeDetails": null
    23 },
    24 {
    25 "key": "kayak-description",
    26 "required": false,
    27 "type": "text",
    28 "typeDetails": null
    29 }
    30 ]
    31 }
    32},
  • Amenity with no fields required

    1{
    2 "fieldsRequired": false,
    3 "key": "water-sports-equipment",
    4 "value": {
    5 "fields": [
    6 {
    7 "key": "description",
    8 "required": false,
    9 "type": "text",
    10 "typeDetails": null
    11 }
    12 ]
    13 }
    14}
  • Amenity that allows multiple enumeration values

    1{
    2 "fieldsRequired": true,
    3 "key": "games",
    4 "value": {
    5 "fields": [
    6 {
    7 "key": "description",
    8 "required": false,
    9 "type": "text",
    10 "typeDetails": null
    11 },
    12 {
    13 "key": "age",
    14 "required": false,
    15 "type": "enum",
    16 "typeDetails": {
    17 "multipleValuesAllowed": true,
    18 "enumTypeDetailsValues": [
    19 "FOR_CHILDREN",
    20 "FOR_ADULTS"
    21 ]
    22 }
    23 }
    24 ]
    25 }
    26}
  • Amenity that does not allow multiple enumeration value

    1{
    2 "fieldsRequired": false,
    3 "key": "wifi-in-unit",
    4 "value": {
    5 "fields": [
    6 {
    7 "key": "description",
    8 "required": false,
    9 "type": "text",
    10 "typeDetails": null
    11 },
    12 {
    13 "key": "fee",
    14 "required": false,
    15 "type": "fee",
    16 "typeDetails": {
    17 "feeTypeValues": [
    18 "UNSPECIFIED_AMOUNT",
    19 "FREE"
    20 ]
    21 }
    22 },
    23 {
    24 "key": "speed",
    25 "required": false,
    26 "type": "enum",
    27 "typeDetails": {
    28 "multipleValuesAllowed": false,
    29 "enumTypeValues": [
    30 "250_MBPS_GOOD_FOR_3_5_PEOPLE_OR_UP_TO_10_DEVICES",
    31 "100_MBPS_GOOD_FOR_1_2_PEOPLE_OR_UP_TO_6_DEVICES",
    32 "50_MBPS",
    33 "500_MBPS_GOOD_FOR_6_PEOPLE_OR_10_DEVICES",
    34 "25_MBPS"
    35 ]
    36 }
    37 }
    38 ]
    39}

Syntax

1query {
2 metadata: Metadata
3}

Examples

The GraphQL explorer is provided for the examples below. Use this interactive explorer to get comfortable with the sample queries.

  • For each query, a test property ID is passed into the explorer; its test data is returned.
  • Click Run Query to execute the query in the explorer on the page. You can modify the query to retrieve the desired fields, and the explorer provides a list of fields when you start typing.
  • Click API Explorer to launch the full explorer in another tab/window, which provides syntax highlighting, schema introspection, real-time error highlighting, and auto-completion, among other things.

Visit this page to view short videos that demonstrate the explorer.

Unit-level features

Unit-level features

API Explorer Alt content

Response

Unit-level amenities

Unit-level amenities

API Explorer Alt content

Response

Unit spaces

Response

Arguments

NameDescription

Types


Name
Type
AcceptedPaymentFormsMetadata
Object

Allowed values for payment card and invoice descriptors.

FieldDescription
paymentCardDescriptorsNot nullable.

Allowed values for payment card descriptors.

Type: PaymentCardDescriptorMetadata
paymentInvoiceDescriptorsNot nullable.

Allowed values for payment card descriptors.

Type: PaymentInvoiceDescriptorMetadata
AmenityFieldEnumTypeDetails
Object

Details about amenity enumerations.

FieldDescription
multipleValuesAllowedNot nullable.

Whether multiple values (details) are allowed for the amenity.

Type: Boolean
valuesNot nullable.

Enumeration values.

Type: Array of non nullable String
AmenityFieldFeeType
Enum

Fee type values for amenities.

NameDescription
FREE
SPECIFIC_AMOUNT
UNSPECIFIED_AMOUNT
AmenityFieldFeeTypeDetails
Object

Amenity fee types.

FieldDescription
valuesNot nullable.

Fee types of an amenity.

Type: Array of non nullable AmenityFieldFeeType
AmenityFieldMeasurementTypeDetails
Object

Values that are allowed or disallowed in amenity measurements.

FieldDescription
decimalsValuesAllowedNot nullable.

Whether the specified values are allowed.

Type: Boolean
valuesNot nullable.

Values to allow or disallow.

Type: Array of non nullable String
AmenityFieldMetadata
Object

Key-value pair that lists the amenity and amenity details.

FieldDescription
keyNot nullable.

Amenity name.

Type: String
requiredNot nullable.

Whether the key must be specified (or whether it’s optional). If an amenity is required ("fieldsRequired": true) but none of the fields is required, any one of the fields must be specified but no individual one is required.

Type: Boolean
typeNot nullable.

Key type:

  • enum – Enumeration, allowed values provided by the enumTypeDetailsValues object; the multipleValuesAllowed field indicates whether more than one enumeration value can be specified
  • trilean - true, false, or null
  • text – Free text
  • fee – Enumeration, allowed values provided by the feeTypeDetailsValues object
  • int – Integer value
  • decimal – Decimal value
Type: String
typeDetails

Allowed values for the amenity.

Type: AmenityFieldTypeDetails
AmenityFieldTypeDetails
Union
AmenityMetadata
Object

Key-value pair that list the amenity.

FieldDescription
fieldsRequiredNot nullable.

Whether at least one field must be specified to save the amenity to the property, unit, or space. When false, no fields are required to save the amenity.

Type: Boolean
keyNot nullable.

Amenity name.

Type: String
valueNot nullable.

Value for the amenity.

Type: AmenityValueMetadata
AmenityValueMetadata
Object

Key-value pairs for each amenity and amenity details.

FieldDescription
fieldsNot nullable.
Type: Array of non nullable AmenityFieldMetadata
BedGroupsMetadata
Object

Supported keys for bed types.

FieldDescription
bedsNot nullable.

Key-value pairs that list the bed types and sizes.

Type: Array of non nullable BedTypeMetadata
BedroomsMetadata
Object

Supported keys for bedrooms.

FieldDescription
bedGroupsNot nullable.

Key-value pairs that list the bed types and sizes.

Type: BedGroupsMetadata
textNot nullable.

Key-value pair that list the text elements.

Type: Array of non nullable TextMetadata
BedTypeMetadata
Object

Supported sizes and types of beds.

FieldDescription
sizeNot nullable.

Bed size.

Type: String
sizesNot nullable.

Bed size(s).

Type: Array of non nullable String
typeNot nullable.

Bed type.

Type: String
BookingPolicyMetadata
Object

Allowed values for accepted forms of payment and booking types.

FieldDescription
acceptedPaymentFormsNot nullable.

Allowed values for accepted forms of payment.

Type: AcceptedPaymentFormsMetadata
bookingTypesNot nullable.

Allowed values for booking types.

Type: Array of non nullable String
Boolean
Boolean

The Boolean scalar type represents true or false.

LivingRoomsMetadata
Object

Supported bed types for living rooms.

FieldDescription
bedGroupsNot nullable.

Key-value pairs that list the bed types and sizes.

Type: BedGroupsMetadata
textNot nullable.

Key-value pairs for text elements that describe living rooms.

Type: Array of non nullable TextMetadata
Locale
Locale

A type that represents a string that conforms to the BCP-47 (RFC 5646) standard. Example: en-GB.

Metadata
Object

Key values and amenities supported for properties.

FieldDescription
localesNot nullable.

Supported locale codes.

Type: Array of non nullable Locale
propertyNot nullable.

Supported keys for amenities, text elements, and unit spaces (bedrooms and living rooms).

Type: PropertyMetadata
PaymentCardDescriptorMetadata
Object

Supported values to use when creating a booking policy.

FieldDescription
codesNot nullable.

Supported values for payment card codes.

Type: Array of non nullable String
typesNot nullable.

Supported values for payment card types.

Type: Array of non nullable String
PaymentInvoiceDescriptorMetadata
Object

Supported values to use when creating a booking policy.

FieldDescription
typesNot nullable.

Supported values for invoice payment types.

Type: Array of non nullable String
PolicyMetadata
Object

Values allowed when defining policies.

FieldDescription
bookingPoliciesNot nullable.

Booking policy values.

Type: BookingPolicyMetadata
PropertyMetadata
Object

Supported keys for amenities, text elements, and unit spaces (bedrooms and living rooms).

FieldDescription
amenitiesNot nullable.

Supported keys for amenities.

Type: Array of non nullable AmenityMetadata
policiesNot nullable.

Supported keys for policies.

Type: PolicyMetadata
textNot nullable.

Supported keys for text elements.

Type: Array of non nullable TextMetadata
typeNot nullable.

Supported keys for property types.

Type: Array of non nullable PropertyTypeMetadata
unitsNot nullable.

Supported keys for unit spaces (bedrooms and living rooms).

Type: UnitsMetadata
PropertyTypeMetadata
Object

Supported keys for property types.

FieldDescription
codeNot nullable.

Property types.

Type: String
SpacesMetadata
Object

Supported keys for unit spaces.

FieldDescription
bedroomsNot nullable.

Supported keys for bedrooms.

Type: BedroomsMetadata
livingRoomsNot nullable.

Supported keys for living rooms.

Type: LivingRoomsMetadata
String
String

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

TextMetadata
Object

Supported keys for text elements.

FieldDescription
keyNot nullable.

Key for text elements.

Type: String
UnitsMetadata
Object

Supported keys for unit amenities and spaces (bedrooms and living rooms).

FieldDescription
amenitiesNot nullable.

Supported keys for amenities.

Type: Array of non nullable AmenityMetadata
spacesNot nullable.

Supported keys for unit spaces (bedrooms and living rooms).

Type: SpacesMetadata