From 0cb8620b7aa9d982de85c193cddbfbade6c40795 Mon Sep 17 00:00:00 2001 From: OliverNikolai Date: Wed, 15 Sep 2021 12:57:47 +0200 Subject: [PATCH] resources & readme update --- README.md | 2 + ...Public_Partner_API.postman_collection.json | 923 ++++++++++++++++++ {assets => resources}/booking-workflow.jpg | Bin 3 files changed, 925 insertions(+) create mode 100644 resources/Public_Partner_API.postman_collection.json rename {assets => resources}/booking-workflow.jpg (100%) diff --git a/README.md b/README.md index 44984a3..73672f4 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ It has a RESTful interface and uses the JSON media format. Access is secured via * [General Information](https://github.com/getyourguide/partner-api-spec/wiki/General-Information) * [Image Formats](https://github.com/getyourguide/partner-api-spec/wiki/Image-Formats) * [Making a booking](https://github.com/getyourguide/partner-api-spec/wiki/Making-a-booking) +* [Adyen Credit Card Checkout](https://github.com/getyourguide/partner-api-spec/wiki/Adyen-payment) +* [Additional Resources](https://github.com/getyourguide/partner-api-spec/tree/main/resources) ## [API Reference](https://code.getyourguide.com/partner-api-spec/) diff --git a/resources/Public_Partner_API.postman_collection.json b/resources/Public_Partner_API.postman_collection.json new file mode 100644 index 0000000..8718643 --- /dev/null +++ b/resources/Public_Partner_API.postman_collection.json @@ -0,0 +1,923 @@ +{ + "info": { + "_postman_id": "70e9fbf4-8b63-460d-bb66-add215d9149e", + "name": "Public Partner API", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "/bookings", + "item": [ + { + "name": "/bookings", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "type": "text", + "value": "{{api_token}}" + }, + { + "key": "Accept", + "type": "text", + "value": "application/json" + }, + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"base_data\": {\n \"cnt_language\": \"{{cnt_language}}\",\n \"currency\": \"{{currency}}\"\n },\n \"data\": {\n \"booking\": {\n \"bookable\": {\n \"option_id\": {{option_id}},\n \"datetime\": \"{{start_time}}\",\n \"price\": \"{{price}}\",\n \"categories\": [\n {\n \"category_id\": \"{{category_id}}\",\n \"number_of_participants\": \"{{pax}}\"\n }\n ],\n \"booking_parameters\": []\n }\n }\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{base_url}}/1/bookings", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "bookings" + ], + "query": [ + { + "key": "date[]", + "value": "2019-02-28T00:00:00", + "disabled": true + }, + { + "key": "date[]", + "value": "2019-02-28T23:59:59", + "disabled": true + } + ] + } + }, + "response": [] + }, + { + "name": "/bookings", + "request": { + "method": "GET", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/1/bookings?cnt_language={{cnt_language}}¤cy={{currency}}", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "bookings" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + } + ] + } + }, + "response": [] + }, + { + "name": "/bookings/{booking_hash}", + "request": { + "method": "GET", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/1/bookings/:booking_hash?cnt_language={{cnt_language}}¤cy={{currency}}", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "bookings", + ":booking_hash" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + } + ], + "variable": [ + { + "key": "booking_hash", + "value": null + } + ] + } + }, + "response": [] + }, + { + "name": "/bookings/{booking_hash}", + "request": { + "method": "DELETE", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/1/bookings/:booking_hash?cnt_language={{cnt_language}}¤cy={{currency}}", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "bookings", + ":booking_hash" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + } + ], + "variable": [ + { + "key": "booking_hash", + "value": "" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "/tours", + "item": [ + { + "name": "/tours by query", + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/1/tours?q=paris&cnt_language={{cnt_language}}¤cy={{currency}}&preformatted=teaser", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "tours" + ], + "query": [ + { + "key": "q", + "value": "paris" + }, + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + }, + { + "key": "preformatted", + "value": "teaser" + }, + { + "key": "limit", + "value": "500", + "disabled": true + } + ] + } + }, + "response": [] + }, + { + "name": "/tours/{tour_id}", + "request": { + "method": "GET", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/1/tours/:tour_id?cnt_language={{cnt_language}}¤cy={{currency}}&preformatted=full", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "tours", + ":tour_id" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + }, + { + "key": "preformatted", + "value": "full" + } + ], + "variable": [ + { + "key": "tour_id", + "value": "{{tour_id}}" + } + ] + } + }, + "response": [] + }, + { + "name": "/tours/{tour_id}/options", + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/1/tours/:tour_id/options?cnt_language={{cnt_language}}¤cy={{currency}}&preformatted=full", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "tours", + ":tour_id", + "options" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + }, + { + "key": "preformatted", + "value": "full" + } + ], + "variable": [ + { + "key": "tour_id", + "value": "{{tour_id}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "/options", + "item": [ + { + "name": "/options/{options_id}", + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/1/options/:option_id?cnt_language={{cnt_language}}¤cy={{currency}}", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "options", + ":option_id" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + } + ], + "variable": [ + { + "key": "option_id", + "value": "{{option_id}}" + } + ] + } + }, + "response": [] + }, + { + "name": "/options/{options_id}/availability", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Request Success\", () => {", + " pm.response.to.have.status(200);", + "});", + "", + "const resp = pm.response.json();", + "const pax = pm.globals.get(\"pax\");", + "const slots = resp.data.availabilities.filter((el) => el.vacancies >= pax);", + "", + "const pricingId = slots[0].pricing_id;", + "pm.globals.set(\"pricing_id\", pricingId);", + "", + "const startTime = slots[0].start_time;", + "pm.globals.set(\"start_time\", startTime);", + "", + "const savings = slots[0].savings;", + "console.log(savings);", + "if(savings !== undefined) {", + " pm.globals.set(\"savings\", savings);", + "} else {", + " pm.globals.set(\"savings\", 0);", + "}", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "type": "text", + "value": "{{api_token}}" + }, + { + "key": "Accept", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{base_url}}/1/options/:option_id/availabilities?cnt_language={{cnt_language}}¤cy={{currency}}", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "options", + ":option_id", + "availabilities" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + } + ], + "variable": [ + { + "key": "option_id", + "value": "{{option_id}}" + } + ] + } + }, + "response": [] + }, + { + "name": "/options/{options_id}/pricing", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Request Success\", () => {", + " pm.response.to.have.status(200);", + "});", + "", + "const resp = pm.response.json();", + "const pricingId = pm.globals.get(\"pricing_id\");", + "const pricing = resp.data.pricing.filter((el) => el.pricing_id === pricingId);", + "const paxType = pm.globals.get(\"pax_type\")", + "const category = pricing[0].categories.filter((el) => el.name === paxType);", + "", + "pm.globals.set(\"category_id\", category[0].id);", + "const pax = pm.globals.get(\"pax\");", + "const priceStructure = category[0].scale.find(", + " el => el.min_participants <= pax && el.max_participants >= pax", + ");", + "const retailPrice = priceStructure.retail_price;", + "", + "const savings = pm.globals.get(\"savings\");", + "const endPrice = pax * retailPrice * (100-savings)/100;", + "pm.globals.set(\"price\", endPrice);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "type": "text", + "value": "{{api_token}}" + }, + { + "key": "Accept", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{base_url}}/1/options/:option_id/pricings?cnt_language={{cnt_language}}¤cy={{currency}}", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "options", + ":option_id", + "pricings" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + } + ], + "variable": [ + { + "key": "option_id", + "value": "{{option_id}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "/carts", + "item": [ + { + "name": "/carts", + "request": { + "method": "POST", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "type": "text", + "value": "{{api_token}}" + }, + { + "key": "Accept", + "type": "text", + "value": "application/json" + }, + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json", + "disabled": true + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"base_data\": {\r\n \"cnt_language\": \"en\",\r\n \"currency\": \"EUR\"\r\n },\r\n \"data\": {\r\n \"shopping_cart\": {\r\n \"shopping_cart_id\": \"323975195\",\r\n \"billing\": {\r\n \"salutation_code\": \"m\",\r\n \"first_name\": \"akash\",\r\n \"last_name\": \"test\",\r\n \"email\": \"akash@ve.com\",\r\n \"is_company\": false,\r\n \"company_name\": null,\r\n \"invoice\": \"false\",\r\n \"address_line_1\": \"test\",\r\n \"address_line_2\": \"\",\r\n \"city\": \"MUMBAI\",\r\n \"postal_code\": \"123456\",\r\n \"state\": \"UNITED ARAB EMIRATES\",\r\n \"country_code\": \"DE\",\r\n \"phone_number\": \"+9123456789\"\r\n },\r\n \"traveler\": {\r\n \"salutation_code\": \"m\",\r\n \"first_name\": \"akash\",\r\n \"last_name\": \"test\",\r\n \"email\": \"akash@ve.com\",\r\n \"phone_number\": \"564564564\"\r\n },\r\n \"payment\": {\r\n \"paypal\": {\r\n \"return_url\": \"https://success.example\",\r\n \"cancel_url\": \"https://failure.example\"\r\n }\r\n }\r\n }\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{base_url}}/1/carts", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "carts" + ] + } + }, + "response": [] + }, + { + "name": "/carts/{shopping_cart_hash}", + "request": { + "method": "GET", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/1/carts/:shopping_cart_hash?cnt_language={{cnt_language}}¤cy={{currency}}", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "carts", + ":shopping_cart_hash" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + } + ], + "variable": [ + { + "key": "shopping_cart_hash", + "value": "9Z3835EMH3EG7G8YVE2Y7SOX98IT4YEV" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "/categories", + "item": [ + { + "name": "/categories by query", + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/1/categories?q=paris&cnt_language={{cnt_language}}¤cy={{currency}}&preformatted=teaser", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "categories" + ], + "query": [ + { + "key": "q", + "value": "paris" + }, + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + }, + { + "key": "preformatted", + "value": "teaser" + }, + { + "key": "limit", + "value": "500", + "disabled": true + } + ] + } + }, + "response": [] + }, + { + "name": "/categories/{category_id}", + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [ + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + }, + { + "key": "Accept", + "value": "application/json", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/1/categories/:category_id?cnt_language={{cnt_language}}¤cy={{currency}}&preformatted=full", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "categories", + ":category_id" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + }, + { + "key": "limit", + "value": "500", + "disabled": true + }, + { + "key": "preformatted", + "value": "full" + } + ], + "variable": [ + { + "key": "category_id", + "value": "44" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "/locations", + "item": [] + }, + { + "name": "/configuration", + "item": [ + { + "name": "/configuration/payment", + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/1/configuration/payment?cnt_language={{cnt_language}}¤cy={{currency}}&country=DE", + "host": [ + "{{base_url}}" + ], + "path": [ + "1", + "configuration", + "payment" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + }, + { + "key": "country", + "value": "DE" + } + ] + } + }, + "response": [] + }, + { + "name": "/configuration/{version}", + "request": { + "method": "GET", + "header": [ + { + "key": "Accept", + "value": "application/json", + "type": "text" + }, + { + "key": "X-ACCESS-TOKEN", + "value": "{{api_token}}", + "type": "text" + } + ], + "url": { + "raw": "{{base_url}}/configuration/:version?cnt_language={{cnt_language}}¤cy={{currency}}", + "host": [ + "{{base_url}}" + ], + "path": [ + "configuration", + ":version" + ], + "query": [ + { + "key": "cnt_language", + "value": "{{cnt_language}}" + }, + { + "key": "currency", + "value": "{{currency}}" + } + ], + "variable": [ + { + "key": "version", + "value": "1" + } + ] + } + }, + "response": [] + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] +} \ No newline at end of file diff --git a/assets/booking-workflow.jpg b/resources/booking-workflow.jpg similarity index 100% rename from assets/booking-workflow.jpg rename to resources/booking-workflow.jpg