Home Features Pricing Contact Login

REST API

Get products

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

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 product
product_id
Integer
The product id of the administration (own number)
name
String
The product name
price
Double
The price of the product
price_incl
Double
The price of the product incl vat
vat_percentage
Double
The vat percentage of the product

Example


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

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 products at the time, max. is 1000

	/*
     * All data is returned in a product object
     * The structure can be found here: https://camping.care/developer/products/get_product.
     */

    $products = $campingcare->get_products($data);

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

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

        public static async void get_products()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***          GET PRODUCTS         ***");
                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 products (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/products/get_product.
                */

                var data = await camping_care.get_products(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",
        "product_id": "1",
        "name": "Product 1",
        "price": "100",
        "price_incl": "121",
        "vat_precentage": "21"
    },
    "1": {
        "id": "2",
        "product_id": "2",
        "name": "Product 2",
        "price": "100",
        "price_incl": "106",
        "vat_precentage": "6"
    },
    "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

6000
No valid API key
6001
No contacts found
6002
No admin ID found
0%
()

Cancel upload