Home Features Pricing Contact Login

REST API

Get contacts

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

Autorication: API Key

Get contact by a search option.

Parameters

offset
Integer
Default the offset = 1, this will return the first set of contacts. One set is limited my the limit parameter.
limit
Integer
The amount of contacts that are returned in the data set. Min. 10 and max. 1000 results.

Response

201
application/json; charset=utf-8
ARRAY of
id
Integer
The id of the contact
contact_id
Integer
The contact_id of the administration (own number)
name
String
The id of the contact for this invoice
created
DateTime
The creation date of the contact

Example


/*
* Example get contacts - How to get a list of contacts from the Camping.care API
* https://camping.care/developer/contacts/get_contacts
*/

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');


    $data = array();
    $data["offset"] = 1 ; // start with the first dataset
    $data["limit"] = 100 ; // returns 100 contacts at the time, max. is 1000

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

    $contacts = $campingcare->get_contacts($data);

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

    echo "Contacts";
    echo "
";
    echo json_encode($contacts, 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 contacts
    {
      
        /*
        * Example get contacts - How to get a list of contacts from the Camping.care API
        * https://camping.care/developer/contacts/get_contacts
        */

        public static async void get_contacts()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***          GET CONTACTS         ***");
                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:
                *   offset    		start offset with contacts (required)
                *   limit           end offset
                *
                */

                var send_data = new List>();
                send_data.Add(new KeyValuePair("offset", "1")); // start with the first dataset
                send_data.Add(new KeyValuePair("limit", "100")); // returns 100 contacts at the time, max. is 1000


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

                var data = await camping_care.get_contacts(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",
        "contact_id": "1",
        "name": "John Doe",
        "created": "2017-12-22 08:16:25",
    },
    "1": {
        "id": "2",
        "contact_id": "2",
        "name": "Doe John",
        "created": "2018-01-04 11:32:12",
    },
    "2": {
        ....
    }
}



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

5000
No valid API key
5001
No contacts found
5002
No admin ID found
0%
()

Cancel upload