Example #1
0
        /*
         * Example get options - How to get acoomodation options the Camping.care API
         * https://camping.care/developer/accommodations/get_options.
         */

        public static async void get_options()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***           GET OPTIONS         ***");
                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 accommodation id. It can be found by using the function get_accommodations
                 * http://camping.care/developer/accommodations/get_accommodations
                 */

                int id = 37;

                /*
                 * Parameters:
                 *   reservation_id     Reservation id for getting options for a specific reservation (optional)
                 *   required_only      To get the required ooptions only if a reservation id is set (optional only in combination with parameter reservation_id)
                 *
                 * You can include additional data to the get options function.
                 * By including the reservation id you only get the options which are available for a specific reservation by setting the reservation_id
                 *
                 * If you choose to get the required options for a specific resercation only you can add the required_only parameter
                 *
                 */
                var send_data = new List <KeyValuePair <string, string> >();
                send_data.Add(new KeyValuePair <string, string>("reservation_id", "638"));
                send_data.Add(new KeyValuePair <string, string>("required_only", "1"));

                /*
                 * All data is returned in a option opject
                 * The structure can be found here: https://camping.care/developer/accommodations/get_options.
                 */
                var data = await camping_care.get_options(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);
            }
        }
Example #2
0
        /*
         * Example get invoices - How to get a specific invoice from the Camping.care API
         * https://camping.care/developer/invoicing/get_invoice
         */

        public static async void get_invoice()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***           GET INVOICE         ***");
                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 invoice id. It can be found by using the function get_invoices
                 * https://camping.care/developer/invoicing/get_invoice
                 */


                int id = 342;

                /*
                 * Parameters:
                 * None
                 *
                 */

                var send_data = new List <KeyValuePair <string, string> >();


                /*
                 * All data is returned in a invoice object
                 * The structure can be found here: https://camping.care/developer/invoicing/get_invoice.
                 */

                var data = await camping_care.get_invoice(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);
            }
        }
        /*
         * Example get reservations - How to get a specific reservation from the Camping.care API
         * https://camping.care/developer/reservations/get_reservations
         */

        public static async void get_reservations()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***       GET RESERVATIONS        ***");
                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:
                 * start_date:		The arrival date where reservations have to be inbetween (required)
                 * end_date:	        The departure date where reservations have to be inbetween (required)
                 *
                 */

                var send_data = new List <KeyValuePair <string, string> >();
                send_data.Add(new KeyValuePair <string, string>("start_date", "2017-01-01")); // (required)
                send_data.Add(new KeyValuePair <string, string>("end_date", "2018-12-31"));   // (required)


                /*
                 * All data is returned in a reservation object
                 * The structure can be found here: https://camping.care/developer/reservations/get_reservation.
                 */

                var data = await camping_care.get_reservations(send_data);



                /*
                 * In this example we print the oprions 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);
            }
        }
        /*
         * Example get calculate_price - How to get calculated price for a specific accommodation between 2 dates from the Camping.care API
         * https://camping.care/developer/accommodations/get_calculate_price
         */

        public static async void get_calculate_price()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***      GET CALCULATE PRICE      ***");
                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:
                 *   accommodation_id    Accommodation id which can be found in the function get_accommodations https://camping.care/developer/accommodations/get_accommodations
                 *   arrival             Arrival date for the availability (required)
                 *   departure           Departure date for the availability (required)
                 *   persons             Number of persons. (required if no age tables)
                 *   age_tables          Array of age table data check https://camping.care/developer/accommodations/get_calculate_price (required if age tables are used in a park)
                 *
                 */

                var send_data = new List <KeyValuePair <string, string> >();
                send_data.Add(new KeyValuePair <string, string>("accommodation_id", "36"));
                send_data.Add(new KeyValuePair <string, string>("arrival", "2018-03-01"));
                send_data.Add(new KeyValuePair <string, string>("departure", "2018-03-10"));
                send_data.Add(new KeyValuePair <string, string>("persons", "2"));

                /*
                 * All data is returned as calculate price opject
                 * The structure can be found here: https://camping.care/developer/accommodations/get_calculate_price.
                 */
                var data = await camping_care.calculate_price(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);
            }
        }
        /*
         * 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 <KeyValuePair <string, string> >();
                send_data.Add(new KeyValuePair <string, string>("offset", "1"));  // start with the first dataset
                send_data.Add(new KeyValuePair <string, string>("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);
            }
        }
Example #6
0
        /*
         * Example get age tables - How to get age table information from the Camping.care API
         * https://camping.care/developer/park/get_age_tables
         */

        public static async void get_age_tables()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***         GET AGE TABLES        ***");
                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:
                 * None
                 *
                 */

                var send_data = new List <KeyValuePair <string, string> >();

                /*
                 * All data is returned in a age table opject
                 * The structure can be found here: https://camping.care/developer/park/get_age_tables.
                 */

                var data = await camping_care.get_age_tables(send_data);


                /*
                 * In this example we print the oprions 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);
            }
        }
Example #7
0
        /*
         * Example update reservation - How to create a reservation from the Camping.care API
         * https://camping.care/developer/reservations/create_reservation
         */
        public static async void update_reservation()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***       UPDATE RESERVATION      ***");
                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");

                int id = 1; // this is the id of the reservation, not the reservation_id (Required)

                /*
                 * Parameters:
                 *   contact_id:     The id of a contact (required)
                 *   options:        he options that are selected by the guest. You can get the available options with this function get options
                 *   finish:         Make it final by setting this variable to true. The reservation will get the status 'pending', this means the reservation is done.
                 */


                var send_data = new List <KeyValuePair <string, string> >();
                send_data.Add(new KeyValuePair <string, string>("contact_id", "192"));

                // Create a age table array and genreate age table JSON data
                var options = new List <option_struct>();

                campingcare.option_struct option0 = new option_struct();
                option0.id    = 29;
                option0.count = 3;

                campingcare.option_struct option1 = new option_struct();
                option1.id    = 30;
                option1.count = 2;

                options.Add(option0);
                options.Add(option1);

                string option_json_string = JsonConvert.SerializeObject(options);

                send_data.Add(new KeyValuePair <string, string>("options", option_json_string));

                send_data.Add(new KeyValuePair <string, string>("finish", "0"));


                /*
                 * All data is returned in a reservation object
                 * The structure can be found here: https://camping.care/developer/reservations/get_reservation.
                 */

                var data = await camping_care.update_reservation(id, 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);
            }
        }
        /*
         * 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 <KeyValuePair <string, string> >();
                send_data.Add(new KeyValuePair <string, string>("email", "*****@*****.**"));
                send_data.Add(new KeyValuePair <string, string>("company", "Camping.care"));
                send_data.Add(new KeyValuePair <string, string>("first_name", "John"));
                send_data.Add(new KeyValuePair <string, string>("last_name", "Doe"));
                send_data.Add(new KeyValuePair <string, string>("gender", "male"));
                send_data.Add(new KeyValuePair <string, string>("address", "Exampleroad"));
                send_data.Add(new KeyValuePair <string, string>("address_number", "123"));
                send_data.Add(new KeyValuePair <string, string>("zipcode", "1234AA"));
                send_data.Add(new KeyValuePair <string, string>("city", "Amsterdam"));
                send_data.Add(new KeyValuePair <string, string>("country", "NL"));
                send_data.Add(new KeyValuePair <string, string>("phone", "+31 123456789"));
                send_data.Add(new KeyValuePair <string, string>("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);
            }
        }
        /*
         * Example create reservation - How to create a reservation from the Camping.care API
         * https://camping.care/developer/reservations/create_reservation
         */

        public static async void create_reservation()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***       CREATE RESERVATION      ***");
                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:
                 *   arrival:            Arrival date for the reservation (YYYY-MM-DD) (required)
                 *   departure:          Departure date for the reservation (YYYY-MM-DD) (required)
                 *   accommodation_id:   Accommodation id for the reservation. The specific id from a accommodation can be get by the function get accommodations
                 *   persons:            The total number of persons in the reservation. (required)
                 *   age_table_input:    The age table input of persons for the reservation. The age table input is a JSON string. (required*) (*if age tables are available)
                 *   card_id:            The id of an discount card. This id can be found with this function. get cards.
                 */

                var send_data = new List <KeyValuePair <string, string> >();


                send_data.Add(new KeyValuePair <string, string>("arrival", "2018-03-01"));
                send_data.Add(new KeyValuePair <string, string>("departure", "2018-03-05"));

                // get your accommodation_id with the api function 'Get accommodations'
                send_data.Add(new KeyValuePair <string, string>("accommodation_id", "36"));

                send_data.Add(new KeyValuePair <string, string>("persons", "5"));


                // Create a age table array and genreate age table JSON data
                var age_tables = new List <age_table_struct>();

                campingcare.age_table_struct age_table0 = new age_table_struct();
                age_table0.id    = 29;
                age_table0.count = 3;

                campingcare.age_table_struct age_table1 = new age_table_struct();
                age_table1.id    = 30;
                age_table0.count = 2;

                age_tables.Add(age_table0);
                age_tables.Add(age_table1);

                string age_table_json_string = JsonConvert.SerializeObject(age_tables);

                send_data.Add(new KeyValuePair <string, string>("age_table_input", age_table_json_string));


                /*
                 * All data is returned in a reservation object
                 * The structure can be found here: https://camping.care/developer/reservations/get_reservation.
                 */

                var data = await camping_care.create_reservation(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);
            }
        }
Example #10
0
        /*
         * Example get accommodation - How to get accommodation information from the Camping.care API
         * https://camping.care/developer/accommodations/get_availability
         */

        public static async void get_availability()
        {
            try
            {
                Console.WriteLine("*************************************");
                Console.WriteLine("***      GET AVAILABILITY         ***");
                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 accommodation id. It can be found by using the function get_accommodations
                 * http://camping.care/developer/accommodations/get_accommodations
                 */
                int id = 123;

                /*
                 * Parameters:
                 *   arrival             Arrival date for the availability (required)
                 *   departure           Departure date for the availability (required)
                 *   places              If set it returns the available places, if this parameter is not set you get the availability count only for this accommodation (optional)
                 *   inactive_places     If set it includes the inactive places in the results (optional)
                 *
                 */

                var send_data = new List <KeyValuePair <string, string> >();

                send_data.Add(new KeyValuePair <string, string>("arrival", "2018-03-01"));
                send_data.Add(new KeyValuePair <string, string>("departure", "2018-03-02"));
                send_data.Add(new KeyValuePair <string, string>("places", "1"));
                send_data.Add(new KeyValuePair <string, string>("inactive_places", "0"));

                /*
                 * All data is returned in a availbility count, if requested also the places are returned in a array of place objects
                 * The structure can be found here: https://camping.care/developer/accommodations/get_availability
                 */

                var data = await camping_care.get_availability(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);
            }
        }