Home Features Pricing Contact Login

REST API

Get price

GET
https://camping.care/api/v1/price/price_id

Autorication: API Key

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

Parameters

Replace the price_id by the price id, for example: "https://camping.care/api/v1/price/3".

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

Response

201
application/json; charset=utf-8
id
Integer
Id of the price
type
String
A string of types: 'price' or 'arrangement'
name
String
The name of the price
start_date
Date
The start date of the price
end_date
Date
The end date of the price
price
Double
The price for the price
duration
Integer
The duration of the price, the duration on which the price is based (for example if duration is 1 a price for 3 nights: 3 * price = total price)
duration_min
Integer
The minimum duration of the price, if the selected period for price calculation is shorter than this value this price cannot be selected
duration_max
Integer
The maximum duration of the price, if the selected period for price calculation is larger than this value this price cannot be selected
arrival_day
Integer
If no arrival day is selected the value is -1: 0 for Sunday till 6 for Friday
discount
Integer
If value is 1 the price is a discount price
card_id
Integer
A card id can be selected for a price. If set the price is only available in a price calculation if a discount card is selected.
backend_only
Integer
If this parameter is set the price should only be available at the backend system. It can not be used for a Guest price calculation
data
JSON String
In this parameter additional data is stored as JSON string. The data field can contain:
- single_price_only: This price can not be combined with other prices in a calculation
accommodation_id
Integer
The specific accommodation id of the price

Example


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

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 price id. It can be found by using the function get_price
    * http://camping.care/developer/prices/get_price
    */

	$price_id =  1; // price 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.
	*/


    $single_price = $campingcare->get_price($price_id, $data); 

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

    echo "Single Price for accommodation";
    echo "
";
    echo json_encode($single_price, 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 price
    {
        /*
        * Example get prices - How to get all prices from the Camping.care API
        * https://camping.care/developer/prices/get_price
        */

        public static async void get_price()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***           GET PRICE           ***");
                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 price id. It can be found by using the function get_price
                * http://camping.care/developer/prices/get_price
                */

                int id = 62;

                /*
                * 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_price(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",
    "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"
}



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
2003
No price found
2004
No admin ID found
2005
No rights for this price
0%
()

Cancel upload