API V2.0: Difference between revisions

Jump to navigation Jump to search
Line 39: Line 39:


Subitems generally work in the same way as their parent items.
Subitems generally work in the same way as their parent items.
*To add a new sub field to an item, include the sub field without an id.
 
*To update a sub field, include its id and one or more other fields.
'''To add a new subitem to an item, include the subitem without an id.'''
*To delete a sub field, include only the sub field’s id.
 
'''''Example: add a new info item to a booking:'''''
{
    "id": {bookingId},
    "infoItems": [
        {
            "code": "this will create",
            "text": "a new info item"
        }
    ]
}
 
'''To update an existing subitem, include the subitem's id.'''
 
'''''Example: update a booking's info item:'''''
{
    "id": {bookingId},
    "infoItems": [
        {
            "id": {infoItemId},
            "text": "this info item will have its text changed"
        }
    ]
}
 
'''To delete a subitem, include only the subitem's id.'''
 
'''''Example: delete a booking's info item:'''''
{
    "id": {bookingId},
    "infoItems": [
        {
            "id": {infoItemId},
        }
    ]
}


= Examples =
= Examples =