Home Features Pricing Contact Login

REST API

Get places

POST
https://camping.care/api/v1/accommodations/id/places

Authentication: API Key

Parameters

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

The specific id from a accommodation can be get by the function Get accommodations.
None

Response

201
application/json; charset=utf-8
Places Array of:
id
Integer
The place id
name
String
The place name
status
enum
The status of the place: enum of 'active, inactive'
rank
Integer
The rank of the place in the places list (if no ranking is active all places have rank 0)
accommodation_id
Integer
Accommodation id of the place

Example


/*
 * Example get places - How to get accomodation places from the Camping.care API
 * https://camping.care/developer/accommodations/get_places.
 */
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 =  37 ; // Accommodation ID (required)

    /*
    * Parameters:
    * none
    *
    */

  
    /*
     * All data is returned in a option opject
     * The structure can be found here: https://camping.care/developer/accommodations/get_places.
     */
    $places = $campingcare->get_places($id);


    /*
    * In this example we print the data in json format on the page
    */
    echo "GET accommodation places";
    echo "
";
    echo json_encode($places, 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 places
    {

        /*
        * Example get discounts - How to get accomodation discounts from the Camping.care API
        * https://camping.care/developer/accommodations/get_places.
        */

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

                /*
                * Parameters:
                none
                *
                */
                
                /*
                * All data is returned in a option opject
                * The structure can be found here: https://camping.care/developer/accommodations/get_places.
                */
                var data = await camping_care.get_discounts(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

{
    "0": {
        "id": "1",
        "name": "A1",
        "status": "active",
        "rank": "1",
        "accommodation_id": "37"
    },
    "1": {
        "id": "2",
        "name": "B2",
        "status": "active",
        "rank": "2",
        "accommodation_id": "37"
    },
    "n": {
        ...
    },

}

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
1041
No places found
1042
No admin ID found
1043
Accommodation not found
1044
No rights for this accommodation
0%
()

Cancel upload