Home Features Pricing Contact Login

REST API

Get accommodations

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

Authentication: API Key

Get a list of basic accommodation data, this data includes the id and names of all park accommodations.

Parameters

language
STRING
Request the accommodation data in a different language (ISO Language Code)

Response

Returns an array with accommodations and id's.

201
application/json; charset=utf-8
id
Integer
The accommodation id
name
String
The accommodation name

Example


/*
* Example get accommodations - How to get all accommodations data from the Camping.care API
* https://camping.care/developer/accommodations/get_accommodations
*/

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:
    * language : ISO language code (optional)
    *
    */
    $data = array();
    $data['language'] = "de" ;

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


    $accommodations = $campingcare->get_accommodations($data);

    /*
     * In this example we print the data in json format on the page
    */
    echo "List of accommodations";
    echo "
";
    echo json_encode($accommodations, JSON_PRETTY_PRINT);
    echo "
"; } catch (Exception $e) { echo "API call failed: " . htmlspecialchars($e->getMessage()); }
using System;
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 accommodations
    {

        /*
        * Example get accommodations - How to get all accommodations data from the Camping.care API
        * https://camping.care/developer/accommodations/get_accommodations
        */

        public static async void get_accommodations()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***      GET ACCOMMODATIONS       ***");
                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:
                * None
                *
                */
                var send_data = new List>();

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

                var data = await camping_care.get_accommodations(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",
	    "name": "Standard Place",
	},
	{
	    "id": "2",
	    "name": "Comfort Place",
	},
	{.....},
	{.....}
]



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

1000
No valid API key
1001
No accommodations found
1002
No admin ID found
0%
()

Cancel upload