Home Features Pricing Contact Login

REST API

Create Webhook

POST
https://camping.care/api/v1/webhooks/

Autorisation: API Key

You can add a webhook to get informed about for example a created reservation

Parameters

url
STRING
Required - url to post the webhook data (must be https)
type
STRING
Required - The type for this webhook: possibilities are: 'reservations'

Response

201
application/json; charset=utf-8
id
Integer
The id of the webhook
url
STRING
The url of the webhook
source
STRING
The source of the channel for this webhook
rights
ARRAY
The webhook function ids which are enabled for this webhook

Example



/*
* Example create webhook - How to add a webhook to the Camping.care API
* https://camping.care/developer/webhook/create_webhook
*/

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:
    *   url:           		Required: The url where the webhook has to post the data to. (The urls must be https)
    *   type:        		The webhook type:
    */

    $data = array();

    $data["url"] = "https://camping.care/webhooks/get_post_data";
    $data["type"] = "reservations";

   
    /*
    * All data is returned in a webhook object
    * The structure can be found here: https://camping.care/developer/webhooks/create_webhooks.
    */
    $webhook = $campingcare->create_webhook($data);

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

    echo "Webhook";
    echo "
";
    echo json_encode($webhook, 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;
using Newtonsoft.Json;

namespace campingcare_csharp_sdk_tests
{
    public static class webhooks
    {
        /*
		* Example create webhook - How to create a webhook to the Camping.care API
		* https://camping.care/developer/webhook/create_webhook
		*/

        public static async void update_energy()
        {
            try
            {

                Console.WriteLine("*************************************");
                Console.WriteLine("***          Create webhook       ***");
                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:
			    *   url:         The url for the webhook (required)
			    *   type:        The webhook type (required)
			    */

                var send_data = new List>();


                send_data.Add(new KeyValuePair("url", "https://camping.care/webhooks/get_post_data"));
                send_data.Add(new KeyValuePair("type", "reservations"));


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

                var data = await camping_care.create_webhook(send_data);

                /*
                * In this example we print the data 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": 1,
    "url": "https:\/\/camping.care\/webhooks\/get_post_datas",
    "rights": [
        201,
        202,
        203
    ]
}



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

8000
No valid API key
8030
No webhook created
8031
No admin ID found
8032
No valid webhook type
8033
Not a https link
8034
Url already exists
0%
()

Cancel upload