Home Features Pricing Contact Login

REST API

Get options

POST
https://camping.care/api/v1/accommodations/id/options

Authentication: API Key

Get availability information about a specific Accommodation between an arrival and a departure date

Parameters

Replace id in the endpoint URL by the accommodation id, for example: "https://camping.care/api/v1/accommodations/2/options".

The specific id from a accommodation can be get by the function Get accommodations.
language
STRING
Request the accommodation data in a different language (ISO Language Code)

Response

201
application/json; charset=utf-8
option array
Integer
The array of options

Example


/*
 * Example get options - How to get acoomodation options the Camping.care API
 * https://camping.care/developer/accommodations/get_options.
 */
try {

    /*
    * Initialize the Camping.care API SDK with your API key.
    *
    * See: https://camping.care/settings/api
    */

    require_once dirname(__FILE__) . '/../../src/campingcare/Autoloader.php';

    $campingcare = new campingcare_api ;
    $campingcare->set_api_key('YOUR API KEY');

    /*
    * Set your accommodation id. It can be found by using the function get_accommodations 
    * http://camping.care/developer/accommodations/get_accommodations
    */

    $id =  37 ; // Accommodation ID (required)

    /*
    * Parameters:
    * language : ISO language code (optional)
    *
    */

    $data = array();
    $data['language'] = "de" ;


    /*
     * All data is returned in a option opject
     * The structure can be found here: https://camping.care/developer/accommodations/get_options.
     */
    $options = $campingcare->get_options($id, $data);


    /*
    * In this example we print the data in json format on the page
    */
    echo "GET accommodation options";
    echo "
";
    echo json_encode($options, JSON_PRETTY_PRINT);
    echo "
"; } catch (Exception $e) { echo "API call failed: " . htmlspecialchars($e->getMessage()); }
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using campingcare;
using Newtonsoft.Json.Linq;


namespace campingcare_csharp_sdk_tests
{
    public static class options
    {

        /*
        * Example get options - How to get acoomodation options the Camping.care API
        * https://camping.care/developer/accommodations/get_options.
        */

        public static async void get_options()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***           GET OPTIONS         ***");
                Console.WriteLine("*************************************");

                /*
                * Initialize the Camping.care API SDK with your API key.
                *
                * See: https://camping.care/settings/api
                */

                campingcare_api camping_care = new campingcare_api();
                camping_care.set_api_key("YOUR API KEY");

                /*
                * Set your accommodation id. It can be found by using the function get_accommodations 
                * http://camping.care/developer/accommodations/get_accommodations
                */

                int id = 37;

                /*
                * Parameters:
                *   reservation_id     Reservation id for getting options for a specific reservation (optional)
                *   required_only      To get the required ooptions only if a reservation id is set (optional only in combination with parameter reservation_id)
                *
                * You can include additional data to the get options function.
                * By including the reservation id you only get the options which are available for a specific reservation by setting the reservation_id
                *
                * If you choose to get the required options for a specific resercation only you can add the required_only parameter
                *
                */
                var send_data = new List>();
                send_data.Add(new KeyValuePair("reservation_id", "638"));
                send_data.Add(new KeyValuePair("required_only", "1"));

                /*
                * All data is returned in a option opject
                * The structure can be found here: https://camping.care/developer/accommodations/get_options.
                */
                var data = await camping_care.get_options(id, send_data);

                /*
                * In this example we print the oprions in json format on the page
                */
                JObject json = JObject.Parse(data.ToString());

                foreach (var pair in json)
                {
                    Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
                }

            }
            catch (Exception ex)
            {
                LogData(ex.Message);
            }
        }

        private static void LogData(string Message)
        {
            Console.WriteLine("Error: " + Message);
        }
    }
}


Response example

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
    "0": {
        "id": "274",
        "name": "Childs bed",
        "description": "",
        "type": "price",
        "type_pro": "period",
        "type_amount": "10",
        "duration": null,
        "duration_min": null,
        "duration_max": null,
        "arrival_day": "0",
        "age_table_id": "0",
        "amount": "1",
        "required": "0",
        "rank": "0",
        "vat_id": "89",
        "data": null,
        "accommodation_id": "74",
        "translation_name": 1
    },
    "n": {
        ...
    }
}

Response Error

Returns an array with error information

230
application/json; charset=utf-8
code
Integer
The error code listed in a list below
message
String
The error message listed in a list below

Error Codes

1000
No valid API key
1025
No options found
1026
No admin ID found
1027
Accommodation not found
1028
No rights for this accommodation
0%
()

Cancel upload