Home Features Pricing Contact Login

REST API

Get prices

GET
https://camping.care/api/v1/prices/accommodation_id

Autorication: API Key

Get a list of prices for a specific accommodation, this data includes the price, period etc

Parameters

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

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
The return is a ARRAY of the function Get price. On this function page the ARRAY parameters are described.

Example


/*
* Example get prices - How to get all prices from the Camping.care API
* https://camping.care/developer/prices/get_prices
*/


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
    */

	$accommodation_id = 1; // Accommodation id here (required)

	 /*
    * Parameters:
    * language : ISO language code (optional)
    *
    */
    $data = array();
    $data['language'] = "de" ;

	/*
	* All data is returned in a price object
	* The structure can be found here: https://camping.care/developer/prices/get_price.
	*/

    $prices = $campingcare->get_prices($accommodation_id, $data); 

    /*
    * In this example we print the data in json format on the page
    */
    echo "Prices for accommodation";
    echo "
";
    echo json_encode($prices, 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 prices
    {
        
        /*
        * Example get prices - How to get all prices from the Camping.care API
        * https://camping.care/developer/prices/get_prices
        */

        public static async void get_prices()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***           GET PRICES          ***");
                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 = 36;

                /*
                * Parameters:
                * None
                *
                */
                var send_data = new List>();

                /*
                * All data is returned in a price object
                * The structure can be found here: https://camping.care/developer/prices/get_price.
                */

                var data = await camping_care.get_prices(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

[
    {
        "id": "1",
        "type": "price",
        "status": "active",
        "name": "pre season",
        "start_date": "2018-01-01",
        "end_date": "2018-12-31",
        "price": "10",
        "duration": "1",
        "duration_min": null,
        "duration_max": null,
        "arrival_day": "-1",
        "discount": "0",
        "card_id": "0",
        "backend_only": "0",
        "data": "{\"single_price_only\":0}",
        "accommodation_id": "333"
    },
    {
        "id": "2",
        "type": "price",
        "status": "active",
        "name": "high season",
        "start_date": "2018-01-01",
        "end_date": "2018-12-31",
        "price": "20",
        "duration": "1",
        "duration_min": null,
        "duration_max": null,
        "arrival_day": "-1",
        "discount": "0",
        "card_id": "0",
        "backend_only": "0",
        "data": "{\"single_price_only\":0}",
        "accommodation_id": "333"
    },
		{.....},
		{.....}
]



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

2000
No valid API key
2001
No prices found
2002
No admin ID found
0%
()

Cancel upload