Home Features Pricing Contact Login

REST API

Getting started

Welcome to the 'Hello World' tutorial of the Camping.care APi. The API is an universal REST API, this means every developer can use it and it can communicatie with almost all scripting languages. In this tutorial we will use PHP as example language.

Requirements

Requirements to get started with the Camping.care REST API

  • Composer (To install the SDK)
  • PHP SDK (Optional)
  • PHP 5.5 (Or higher) webserver
  • Camping.care API Key

1: Install the SDK

Composer install

Install composer if you don't have it installed. https://getcomposer.org/

Get the Camping.care SDK by running the following command

composer require CampingCare/campingcare-php-sdk

Manual install

Download the source code via Github: https://github.com/CampingCare/campingcare-php-sdk

2: Get your API key

  • Be sure you have an active Camping.care park and inlog.
  • Go to API Settings of your park.
  • Create an API key

3: Make your first API request

Once you have your API key we are almost ready. In this tutorial we will get the list of your accommodations, it's very easy by running the following code.

// Load your vendor Autoloader
// if you installed the SDK manual load the Autoloader.php directly from the SDK

require_once('vendor/autoload.php');

$campingcare = new campingcare_api ;
$campingcare->set_api_key("YOUR SECRET API KEY");

try{
	
	$park = $campingcare->get_park();

    echo "
";
    print_r($park); 
    echo "
"; }catch(Exception $e){ echo "API call failed: " . htmlspecialchars($e->getMessage()); }

If everything is right, you will get a response like this.

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
	{
	    "id": "1",
	    "name": "Standard Place",
	},
	{
	    "id": "2",
	    "name": "Comfort Place",
	},
	{.....},
	{.....}
]

You're done! That's all, try and play with our API.

0%
()

Cancel upload