Home Features Pricing Contact Login

REST API

Get reservation options

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

Authentication: API Key

Get the options which are available for a specific reservation

Parameters

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

The specific id from a reservation can be get by the function Get reservations.
reserequired_only
INT
You can get the required reservation options only by setting this parameter to 1.

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');
    $campingcare->set_api_key('9Y3RTnEEMMAeytF75fmpvnPdr+oIqYuXIg0WaQrMhF9RSEk61qkds5rDeS0fUI+qz72qCwvuFOydmQT3u85y5A==');
    $campingcare->set_api_url('http://localhost:8084/api/v1');



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

    $id =  638 ; // Reservation ID (required)

    /*
    * Parameters:
    *   required_only      To get the required ooptions only if a reservation id is set (optional only in combination with parameter reservation_id)
    *
    */

    $data = array();
    $data['required_only'] = 0 ; // optional: to get the required options for a specific reservation


    /*
     * All data is returned in a option opject
     * The structure can be found here: https://camping.care/developer/accommodations/get_options.
     */
    $options = $campingcare->get_reservation_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.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 reservation_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_reservation_options()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***   GET RESERATION 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 reservation id. It can be found by using the function get_accommodations 
                * http://camping.care/developer/reservations/get_reservations
                */

                int id = 37;

                /*
                * Parameters:
                *   required_only      To get the required ooptions only if a reservation id is set (optional only in combination with parameter reservation_id)
                *
                *
                */
                var send_data = new List>();
                send_data.Add(new KeyValuePair("required_only", "0"));

                /*
                * All data is returned in a option opject
                * The structure can be found here: https://camping.care/developer/accommodations/get_reservation_options.
                */
                var data = await camping_care.get_reservation_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

{ "count": 22 }

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

3000
No valid API key
3025
No options found
3026
No admin ID found
3027
Reservation not found
3028
No rights for this reservation
3029
No accommodation id found for this reservation
0%
()

Cancel upload