Home Features Pricing Contact Login

REST API

Get reservations

GET
https://camping.care/api/v1/reservations

Autorication: API Key

Get all reservations overlapping by specific arrival and departure date.

Parameters

start_date
Date
Required - The start date of the reservations arrival date in the format yyyy-mm-dd
end_date
Date
Required - The end date of the reservations arrival date in the format yyyy-mm-dd
201
application/json; charset=utf-8
id
Integer
The id of the reservation
reservation_id
Integer
The reservation id of the administration
contact_id
Integer
The id of the contact for this reservation
place_id
Integer
The place id of the accommodation for this reservation
status
String
The status of the reservation in a string: with status 'draft', 'pending', 'option', 'confirmed', 'checkedin', 'checkedout' or 'deleted'
payment
String
The payment of the reservation in a string: with payment status 'unpaid', 'partly_paid' or 'paid'
arrival
Date
Arrival date of the reservation
departure
Date
Departure date of the reservation
create_date
Date
Creation date of the reservation
total
Date
Total price of the reservation
accommodation_id
Integer
The id of the accommodation for this reservation

Example


/*
* Example get reservations - How to get reservations between a arrival and departure date from the Camping.care API
* https://camping.care/developer/reservations/get_reservations
*/

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');

	/*
    * Parameters:
    * arrival:		The arrival date where reservations have to be inbetween (required)
    * departure:	The departure date where reservations have to be inbetween (required)
    *
    */

	$data = array();
	$data["start_date"] = "2017-01-01"; // date YYYY-MM-DD  (required)
	$data["end_date"] = "2018-12-31";  // date YYYY-MM-DD (required)

	/*
	* All data is returned in a reservation object
	* The structure can be found here: https://camping.care/developer/reservations/get_reservation.
	*/

    $reservations = $campingcare->get_reservations($data); 

    /*
    * In this example we print the data in json format on the page
    */

    echo "Get reservations between dates";
    echo "
";
    echo json_encode($reservations, 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 reservations
    {
        /*
         * Example get reservations - How to get a specific reservation from the Camping.care API
         * https://camping.care/developer/reservations/get_reservations
         */

        public static async void get_reservations()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***       GET RESERVATIONS        ***");
                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");


                /*
                * Parameters:
                * start_date:		The arrival date where reservations have to be inbetween (required)
                * end_date:	        The departure date where reservations have to be inbetween (required)
                *
                */

                var send_data = new List>();
                send_data.Add(new KeyValuePair("start_date", "2017-01-01")); // (required)
                send_data.Add(new KeyValuePair("end_date", "2018-12-31")); // (required)


                /*
                * All data is returned in a reservation object
                * The structure can be found here: https://camping.care/developer/reservations/get_reservation.
                */

                var data = await camping_care.get_reservations(send_data);



                /*
                * In this example we print the oprions in json format in the console
                */

                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": "1",
        "reservation_id": "1",
        "contact_id": "1",
        "place_id": "0",
        "status": "confirmed",
        "payment": "unpaid",
        "arrival": "2018-01-22",
        "departure": "2018-01-25",
        "create_date": "2017-12-22 08:16:19",
        "total": "45",
        "accommodation_id": "33"
    },
    "1": {
        "id": "2",
        "reservation_id": "2",
        "contact_id": "2",
        "place_id": "0",
        "status": "pending",
        "payment": "unpaid",
        "arrival": "2018-02-06",
        "departure": "2018-02-13",
        "create_date": "2018-01-04 11:32:06",
        "total": "99",
        "accommodation_id": "33"
    },
    "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

3000
No valid API key
3001
No prices found
3002
No admin ID found
3003
Not a valid arrival date
3004
Not a valid departure date
3005
End date is before start date
0%
()

Cancel upload