Home Features Pricing Contact Login

REST API

Get product

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

Autorication: API Key

Get a specific contact by id.

Parameters

Replace id in the endpoint URL by the invoice id, for example: "https://camping.care/api/v1/products/2".

Response

201
application/json; charset=utf-8
id
Integer
The id of the product
product_id
Integer
The contact_id of the administration (own number)
name
String
The name of the product
price
Double
The price of the product
price_incl
Double
The price including vat of the product
vat_procent
Double
The vat percentage of the product

Example


/*
* Example get product - How to get a specific product from the Camping.care API
* https://camping.care/developer/products/get_product
*/

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

	/*
    * Set your product id. It can be found by using the function get_contacts
    * https://camping.care/developer/products/get_product
    */

	$product_id = 1;


	/*
    * Parameters:
    * None
    *
    */

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

	$product= $campingcare->get_product($product_id);

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

    echo "Product";
    echo "
";
    echo json_encode($product, 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
    {

        /*
        * Example get product - How to get a specific product from the Camping.care API
        * https://camping.care/developer/products/get_product
        */

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

                /*
                * Set your contact id. It can be found by using the function get_products
                * https://camping.care/developer/products/get_products
                */

                int id = 191;

                /*
                * Parameters:
                * None
                *
                */

                var send_data = new List>();

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

                var data = await camping_care.get_product(id, 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

{
    "id": "1",
    "contact_id": "1",
    "admin_id": "1",
    "name": "Product",
    "status": "active",
    "price": "10",
    "price_incl": "12,10",
    "vat_percentage": "21",
}


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
6003
No product found
6004
No admin ID found
6005
No rights for this product
0%
()

Cancel upload