index

modifyProperty 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"
    },
    "modifyProperty": [
        {
            "action": "modify",
            "notifyUrl": "https:\/\/www.example.com",
            "currency": "USD",
            "agodaComPropertyCode": "123456",
            "bookingComPropertyCode": "123456",
            "expediaComUsername": "username",
            "expediaComPassword": "password",
            "expediaComPropertyCode": "123456",
            "expediaComCurrency": "USD"
        }
    ]
}

Add New Room

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

Modify Room

{
    "authentication": {
        "apiKey": "apiKeyAsSetInAccountSettings",
        "propKey": "propKeyAsSetForTheProperty"
    },
    "modifyProperty": [
        {
            "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"
                }
            ]
        }
    ]
}

Delete Room

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

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;

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

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

$url = "https://api.beds24.com/json/modifyProperty";

$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;	

?>