index

setProperty JSON


Instructions

Post JSON data here to modify a property in an account.

See here for information about using the JSON API.

The JSON data is similar to that returned by getProperty. See it for information about the data fields.

The property must have an action element with a value of modify to allow any changes.

Each room can have an action element with a value of new, modify or delete. If the action element is missing or not one of these values no change will be made to that room.

It is not necessary to include all data fields. Only include the fields that are being changed.

Example Data

Modify Property

{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "setProperty": [
        {
            "action": "modify",
            "notifyUrl": "https:\/\/www.example.com",
            "currency": "USD",
            "agodaComPropertyCode": "123456",
            "bookingComPropertyCode": "123456",
            "expediaComPropertyCode": "123456",
            "expediaComCurrency": "USD"
        }
    ]
}

Add New Room

{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "setProperty": [
        {
            "action": "modify",
            "roomTypes": [
                {
                    "action": "new",
                    "name": "Room 1",
                    "qty": "1",
                    "minPrice": "1.00"
                }
            ]
        }
    ]
}

Modify Room

{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "setProperty": [
        {
            "action": "modify",
            "roomTypes": [
                {
                    "action": "modify",
                    "roomId": "1234",
                    "name": "New Name",
                    "qty": "2",
                    "minPrice": "100.00",
                    "maxPeople": "3",
                    "p1Sync": "3",
                    "p2Sync": "0",
                    "p3Sync": "0",
                    "p4Sync": "0",
                    "dependentRoomId1": "0",
                    "dependentRoomId2": "0",
                    "dependentRoomId3": "0",
                    "dependentRoomId4": "0",
                    "dependentRoomId5": "0",
                    "dependentRoomId6": "0",
                    "dependentRoomId7": "0",
                    "dependentRoomId8": "0",
                    "dependentRoomLogic": "0",
                    "agodaComEnableInventory": "0",
                    "agodaComEnablePrice": "0",
                    "agodaComEnableBooking": "0",
                    "agodaComRoomCode": "1234567",
                    "airbnbComEnableInventory": "0",
                    "airbnbComEnableBooking": "0",
                    "airbnbComRoomCode": "http:\/\/airbnb.com\/your\/calendar",
                    "bookingComEnableInventory": "0",
                    "bookingComEnableBooking": "0",
                    "bookingComRoomCode": "1234567",
                    "bookingComRateCode": "12345678",
                    "expediaComEnableInventory": "0",
                    "expediaComEnablePrice": "0",
                    "expediaComEnableBooking": "0",
                    "expediaComRoomCode": "1234567",
                    "expediaComRateCode": "12345678"
                }
            ]
        }
    ]
}

Modify Room Unit

{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "setProperty": [
        {
            "action": "modify",
            "roomTypes": [
                {
                    "action": "modify",
                    "roomId": "1234",
                    "units": {
                        "2": {
                            "note": "A text note for unit two"
                        }
                    }
                }
            ]
        }
    ]
}

Delete Room

{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "setProperty": [
        {
            "action": "modify",
            "roomTypes": [
                {
                    "action": "delete",
                    "roomId": "1235"
                }
            ]
        }
    ]
}

Grant Access to a Sub Account

{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "setProperty": [
        {
            "action": "modify",
            "accountAccess": [
                {
                    "ownerId": "12345",
                    "controlPanel": "2",
                    "inventory": "2",
                    "bookings": "2"
                }
            ]
        }
    ]
}

Grant Access with Association Code

{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "setProperty": [
        {
            "action": "modify",
            "accountAccess": [
                {
                    "ownerId": "12345",
                    "associationCode": "ABCDEFGHIJK",
                    "controlPanel": "2",
                    "inventory": "2",
                    "bookings": "2"
                }
            ]
        }
    ]
}

Revoke Access to Account

{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "setProperty": [
        {
            "action": "modify",
            "accountAccess": [
                {
                    "ownerId": "12345",
                    "controlPanel": "0",
                    "inventory": "0",
                    "bookings": "0"
                }
            ]
        }
    ]
}

Sample PHP code

<?php

/*
* The following sample uses PHP arrays to construct the JSON data and php-curl to post it to the API.
* This sample will set the property currency to EUR and the room name to "Room 2" on the room with the given roomId. 
* Change the apiKey, propKey and roomId to values for your account to use and test.
*/

$authentication = array();
$authentication['apiKey'] = 'apiKeyAsSetInAccountSettings';
$authentication['propKey'] = 'propKeyAsSetForTheProperty';


$room = array();
$room['action'] = 'modify';
$room['roomId'] = '1234';
$room['name'] = 'Room 2';

$roomTypes = array();
$roomTypes[] = $room;

$prop = array();
$prop['action'] = 'modify';
$prop['currency'] = 'EUR';
$prop['roomTypes'] = $roomTypes;

$setProperty = array();
$setProperty[] = $prop;

$data = array();
$data['authentication'] = $authentication;
$data['setProperty'] = $setProperty;
$json = json_encode($data);

$url = "https://manage.bookingautomation.com/api/json/setProperty";

$ch=curl_init();
curl_setopt($ch, CURLOPT_POST, 1) ;
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
$result = curl_exec($ch);
curl_close ($ch);
echo $result;	

?>