Home Features Pricing Contact Login

REST API

Update prices

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

Autorication: API Key

Update prices and stock on a specific time period

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.
data
ARRAY
array of prices or stock

array elements:
- start_date (Required)
- end_date (Required)

when price only:

- price
- name
- duration
- duration_min (optional)
- duration_max (optional)
- stock (optional)

when stock only

- stock

Response

201
application/json; charset=utf-8

Example Stock and Prices


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

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

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

    $price = array();
    $price["start_date"] = "2019-09-01";
    $price["end_date"] = "2019-09-30";
    $price["price"] = 22;
    $price["name"] = "Low season 1";
    $price["duration"] = 1;
    $price["stock"] = 1;

    $data["data"][] = $price;

    $price = array();
    $price["start_date"] = "2019-10-01";
    $price["end_date"] = "2019-10-31";
    $price["price"] = 18;
    $price["name"] = "Low season 2";
    $price["duration"] = 1;
    $price["stock"] = 1;

    $data["data"][] = $price;

	/*
	* All data is returned in a price object
	*/


    $price_array = $campingcare->update_prices($accommodation_id, $data); 

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

    echo "Price array accommodation";
    echo "
";
    echo json_encode($price_array, 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/update_prices
        */

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

                int id = 62;

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

                /*
                * All data is returned in a price object
                */

                var data = await camping_care.update_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);
        }
    }
}


Example Prices Only


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

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

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

    $price = array();
    $price["start_date"] = "2019-09-01";
    $price["end_date"] = "2019-09-30";
    $price["price"] = 22;
    $price["name"] = "Low season 1";
    $price["duration"] = 1;

    $data["data"][] = $price;

    $price = array();
    $price["start_date"] = "2019-10-01";
    $price["end_date"] = "2019-10-31";
    $price["price"] = 18;
    $price["name"] = "Low season 2";
    $price["duration"] = 1;

    $data["data"][] = $price;

	/*
	* All data is returned in a price object
	*/


    $price_array = $campingcare->update_prices($accommodation_id, $data); 

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

    echo "Price array accommodation";
    echo "
";
    echo json_encode($price_array, 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/update_prices
        */

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

                int id = 62;

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

                /*
                * All data is returned in a price object
                */

                var data = await camping_care.update_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);
        }
    }
}


Example Stock only


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

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

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

    $price = array();
    $price["start_date"] = "2019-09-01";
    $price["end_date"] = "2019-09-30";
    $price["stock"] = 2;
   
    $data["data"][] = $price;

    $price = array();
    $price["start_date"] = "2019-10-01";
    $price["end_date"] = "2019-10-31";
    $price["stock"] = 1;

    $data["data"][] = $price;

	/*
	* All data is returned in a price object
	*/


    $price_array = $campingcare->update_prices($accommodation_id, $data); 

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

    echo "Price array accommodation";
    echo "
";
    echo json_encode($price_array, 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/update_prices
        */

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

                int id = 62;

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

                /*
                * All data is returned in a price object
                */

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


{
    ok
}



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
2007
No admin ID found
2008
No accommodation id found
2009
No price or stock data found
2010
No valid start date of one of the prices /stock
2011
No valid start date of one of the prices /stock
2012
End date before start date of one of the prices / stock
2013
start date invalid of one of the prices /stock
2014
end date invalid of one of the prices /stock
0%
()

Cancel upload