Setting Meta attributes for Services & Resources
If your company needs to store other custom attributes on your Resources and Services that are not natively supported in Waitwhile, you can use the metadata
property. The property is an object where you can save up to 20 unique keys each containing a string
value up to 500 characters.
{
metadata: {
"discount": "20",
"quantity": "200",
"fee": "$20"
}
}
Updates to a metadata object will be merged with the existing object, so writing a value with the same key name overwrites the old value but new keys would just be added even if you do not provide existing keys and their values.
To delete a key you make an update to the metadata object with null
as the value.
Example
For example, if you want to map your Services in Waitwhile to your POS system using a POS-specific ID, you can now save this to the service as a meta attribute like so:
POST /v2/resources/{RESOURCE_ID}
{
metadata: {
"pos_id": "abcdefg123456"
}
}
If you then want to make an update which adds a new key while keeping the old key, you can just post an update:
POST /v2/resources/{RESOURCE_ID}
{
metadata: {
"description": "This is a resource"
}
}
The result would be:
{
metadata: {
"pos_id": "abcdefg123456",
"description": "This is a resource"
}
}
To delete a key:
POST /v2/resources/{RESOURCE_ID}
{
metadata: {
"pos_id": null
}
}
Results in:
{
metadata: {
"description": "This is a resource"
}
}
Limitations
- Max number of keys: 20
- Max size of value: 500
- Max size of keys: 40
Updated 8 months ago