Home Features Pricing Contact Login

REST API

Get accommodation

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

Authentication: API Key

Get detailed accommodation data, this data includes the name, description, thumbnail, services etc.

Parameters

Replace id in the endpoint URL by the accommodation id, for example: "https://camping.care/api/v1/accommodations/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
id
Integer
Id of the accommodation
status
String
Enummeration of 'active', 'nonactive' and 'deleted'
name
String
The name of the accommodation
create_date
String
The date of creation of the accommodation
persons_max
Integer
Maximum amount of persons for the accommodation
persons_min
Integer
Minumum amount of persons for the accommodation
persons_included
Integer
Included amount of persons for the accommodation
places_count
Integer
Number of places for the accommodation
enabled_places_count
Integer
Number of enabled places for the accommodation
thumb
String
URL of the thumb for the accommodation
description
String
Description of the accommodations
selected_services
Json string
All services id's in json string

Example

/*
* Example get accommodation - How to get accommodation information from the Camping.care API
* https://camping.care/developer/accommodations/get_accommodation
*/

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

	$id =  1; // Accommodation ID (required)

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



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

	$accommodation = $campingcare->get_accommodation($id, $data);

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

	echo "Data from a single Accommodation";
	echo "
";
	echo json_encode($accommodation, 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 accommodation
    {

        /*
        * Example get accommodation - How to get accommodation information from the Camping.care API
        * https://camping.care/developer/accommodations/get_accommodation
        */

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

                /*
                * Parameters:
                * None
                *
                */

                var send_data = new List>();

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

                var data = await camping_care.get_accommodation(id, 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

{
    "id":        				"2",
    "status":            		"active",
    "name": 					"Comfort Place",
    "create_date":          	"2017-09-20 18:47:15",
    "persons_max":    			6,
    "persons_min":          	1,
    "persons_included":     	2,
    "places_count":          	10,
    "enabled_places_count":     9,
    "thumb":					"http://camping.care/_ah/img/encoded_gs_file:some_image_hash",
    "description":				"Comfort Place detailed description text",
    "modified":					"2017-11-15 20:19:34",
    "selected_services":		"[33,32]"
}

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
1003
No accommodation found
1004
No admin ID found
1005
Accommodation not found
1006
No rights for this accommodation
0%
()

Cancel upload