Home Features Pricing Contact Login

REST API

Create contact

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

Autorication: API Key

Create a new contact in Camping.care. Or, if the e-mail address already exists, we will return an existing contact.

Parameters

email
String
Required - The email of the contact.
company
String
The company name of the contact.
first_name
String
The first name of the contact.
last_name
String
Required - The last name of the contact.
gender
String
The gender of the contact. ('male', 'female' or 'family')
address
String
The address of the contact.
address_number
String
The address number of the contact.
zipcode
String
The zip code of the contact.
city
String
The city of the contact.
country
String
The country of the contact in ISO 3166 1 - Alpha 2 format. ('NL', 'IT' , etc)
phone
String
The phone of the contact.
birthday
Date
The birthday of the contact (YYYY-MM-DD)

Response

201
application/json; charset=utf-8
An contact object as described in the get contact api function.

Example


/*
* Example get contacts - How to get a specific contacts from the Camping.care API
* https://camping.care/developer/contacts/create_contact
*/



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:
    *   email           The email of the contact. (required)
    *   company         The company name of the contact.
    *   first_name      The first name of the contact.
    *   last_name       The last name of the contact. (required)
    *   gender          The gender of the contact. ('male', 'female' or 'family')
    *   address         The address of the contact.
    *   address_number  The address number of the contact.        
    *   zipcode         The zip code of the contact.
    *   city            The city of the contact.
    *   country         The country of the contact in ISO 3166 1 - Alpha 2 format. ('NL', 'IT', etc)
    *   phone           The phone of the contact.
    *   birthday        The birthday of the contact(YYYY - MM - DD)
    *
    */

	$data = array();

    $data["email"] = "info@example.com"; // A valid email address is required

    $data["first_name"] = "John" ;
    $data["last_name"] = "Doe" ; // A last name is required
    $data["gender"] = "male";

    $data["address"] = "Example street";
    $data["address_number"] = "666";
    $data["zipcode"] = "1337OK";
    $data["city"] = "ExampleCity";
    $data["country"] = "DE";

    $data["phone"] = "0031 85 065 3614";
    $data["birthday"] = "1986-01-25";

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

	$contact = $campingcare->create_contact($data);

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

    echo "Contact";
    echo "
";
    echo json_encode($contact, 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 contact_new
    {

        /*
        * Example get contacts - How to get a specific contacts from the Camping.care API
        * https://camping.care/developer/contacts/get_contact
        */

        public static async void create_contact()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***        CREATE CONTACT         ***");
                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:
                *   email           The email of the contact. (required)
                *   company         The company name of the contact.
                *   first_name      The first name of the contact.
                *   last_name       The last name of the contact. (required)
                *   gender          The gender of the contact. ('male', 'female' or 'family')
                *   address         The address of the contact.
                *   address_number  The address number of the contact.        
                *   zipcode         The zip code of the contact.
                *   city            The city of the contact.
                *   country         The country of the contact in ISO 3166 1 - Alpha 2 format. ('NL', 'IT', etc)
                *   phone           The phone of the contact.
                *   birthday        The birthday of the contact(YYYY - MM - DD)
                *
                */


                var send_data = new List>();
                send_data.Add(new KeyValuePair("email", "johndoe@example.com"));
                send_data.Add(new KeyValuePair("company", "Camping.care"));
                send_data.Add(new KeyValuePair("first_name", "John"));
                send_data.Add(new KeyValuePair("last_name", "Doe"));
                send_data.Add(new KeyValuePair("gender", "male"));
                send_data.Add(new KeyValuePair("address", "Exampleroad"));
                send_data.Add(new KeyValuePair("address_number", "123"));
                send_data.Add(new KeyValuePair("zipcode", "1234AA"));
                send_data.Add(new KeyValuePair("city", "Amsterdam"));
                send_data.Add(new KeyValuePair("country", "NL"));
                send_data.Add(new KeyValuePair("phone", "+31 123456789"));
                send_data.Add(new KeyValuePair("birthday", "2018-01-01"));

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

                var data = await camping_care.create_contact(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

The response is the same as it would be in the get contact api function.

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

{
    "id": "1",
    "contact_id": "1",
    "admin_id": "1",
    "name": "John Doe",
    "created": "2017-12-22 08:16:25",
    "status": "active",
    "company": "",
    "first_name": "John",
    "last_name": "Doe",
    "gender": "male",
    "birthday": "1986-01-25",
    "zipcode": "1234AB",
    "city": "Amsterdam",
    "address": "Canalroad",
    "address_number": "1",
    "email": "johndoe@example.com",
    "country": "NL",
    "phone": "0612345678",
    "phone_mobile": "",
    "vat_number": "",
    "reservation_count": "1",
    "inv_count_invoice_active": "1"
}


Error Codes

5007
No admin ID found
5008
No contact ID created
5009
Could not update contact
0%
()

Cancel upload