Skip to content

Instantly share code, notes, and snippets.

@4eRTuk
Last active April 25, 2023 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4eRTuk/6b6a4b06b5f6d4ce90973e1931052991 to your computer and use it in GitHub Desktop.
Save 4eRTuk/6b6a4b06b5f6d4ce90973e1931052991 to your computer and use it in GitHub Desktop.
WeGoTrip API

WeGoTrip API

Instruction for the integration of tour purchases

Contents

  1. Introduction to API
  2. Getting started
  3. List of endpoints
  1. Rendering the product card
  2. Payments
  3. Cookies and rewards
  4. Testing and other questions

Introduction to API

API allows you to get data about tours and tickets on WeGoTrip, language and currencies, cities and countries, attractions, which are available in the store at that moment.

Base URL

Here and further JavaScript (ES2015)

const API_URL = "https://app.wegotrip.com/api/v2"; const API_URL = "https://app.wegotrip.com/api/v3";

Request headers

Accept-Language: en - for partial localization of content (names of countries, cities etc.)

Response format

Content-Type: application/json; charset=utf-8

Getting started

To generate referral links for tours you need SUB_ID (if you work via TravelPayouts) or REFERER_ID (if you work directly with the WeGoTrip Affiliate Program).

List of endpoints

List of languages

GET /languages/

List of currencies

GET /currencies/

List of countries

GET /countries/

GET-parameters
Parameter Meaning Available values Example
page Paginator page In 1-pages from the response 1

List of cities

GET /cities/

GET-parameters
Parameter Meaning Available values Example
page Paginator page In 1-pages from the response 1
lang Product language code (content, descibtion) code from GET /languages/ en
country Country unique identifier id from GET /search/ or GET /countries/ 3017382
popular Sort by popularity true (default) or false true

List of attractions

GET /attractions/

GET-parameters
Parameter Meaning Available values Example
page Paginator page In 1-pages from the response 1
lang Product language code (content, descibtion) code from GET /languages/ en
country Country unique identifier id from GET /search/ or GET /countries/ 3017382
city City unique identifier id from GET /search/ or GET /cities/ 3
popular Sort by popularity true (default) or false true

Partial name search (products/cities/attractions)

Needs 3 and more letters.

GET /search/?query=Pari

GET-parameters
Parameter Meaning Available values Example
query String search query Any strings Pari
currency Currency code for displaying prices for products code from GET /currencies/ USD

Products

GET /products/popular/?lang=en&city=3&currency=EUR

GET-parameters
Parameter Meaning Available values Example
page Paginator page In 1-pages from the response 1
lang Product language code (content, descibtion) code from GET /languages/ en
currency Currency code for displaying prices for products code from GET /currencies/ USD
country Country unique identifier id from GET /search/ or GET /countries/ 3017382
city City unique identifier id from GET /search/ or GET /cities/ 3
attraction Attraction unique identifier id from GET /search/ or GET /attractions/ 3
order Sorting type popularity (default) or random popularity

Decoded response: in the data object in the results key there is an array of objects which represent products

{
	"data": {
		"count": 1,
		"pages": 1,
		"current": 1,
		"next": null,
		"results": [{
				"id": 25,
				"title": "Masterpieces of Louvre: Skip-the-Line Ticket & Audio Tour",
				"slug": "masterpieces-of-louvre",
				"duration": "1.5 hours",
				"cover": "https://app.wegotrip.com/media/store/daniele-d-andreti-ud9u7beav2s-unsplash-01.jpeg",
				"preview": "https://app.wegotrip.com/media/CACHE/images/store/daniele-d-andreti-ud9u7beav2s-unsplash-01/8c0e7d435664cc855ec7326961469849.jpeg",
				"price": 35.0,
				"exprice": 35.0,
				"currency": "€",
				"currencyCode": "EUR",
				"rating": null,
				"reviewsCount": 0,
				"ratingsCount": 0,
				"category": "Art & Museums",
				"city": {
					"id": 3,
					"name": "Paris",
					"slug": "paris"
				},
				"durationMin": 90,
				"durationMax": 90,
				"type": 3,
				"tags": {
					"audioguide": true,
					"available": true
				},
				"locale": "en",
				"author": {
					"avatar": "https://app.wegotrip.com/media/users/1/path32.png",
					"name": "WeGoTrip",
					"bio": "Better to see something once than hear about it a thousand times",
					"nickname": "wegotrip"
				}
			},
      ...
		],
		"maxPrice": 60.51
	}
}

Information about a product

GET /products/{ID}/?currency=USD

GET-parameters
Parameter Meaning Available values Example
currency Currency code for the prices code from GET /currencies/ USD

Decoded response: in the data object there is an object that represents the product

{
	"data": {
		"id": 63,
		"slug": "edinburgh-harry-potter-tour",
		"title": "Edinburgh: Harry Potter-Themed Tour & Audio Guide",
		"cover": "https://app.wegotrip.com/media/store/Edinburgh_Harry_Potter-Themed_Tour.jpg",
		"preview": "https://app.wegotrip.com/media/CACHE/images/store/Edinburgh_Harry_Potter-Themed_Tour/206c15cfc527cd26df5978ee38db3c8e.jpg",
		"images": [{
				"id": 3704,
				"description": "",
				"cover": false,
				"preview": "https://app.wegotrip.com/media/CACHE/images/store/63/edinburgh-castle-959083/3b43caf3046dfd75468dea8d5ee47022.jpg",
				"full": "https://app.wegotrip.com/media/store/63/edinburgh-castle-959083.jpg"
			}, {
				"id": 3705,
				"description": "",
				"cover": false,
				"preview": "https://app.wegotrip.com/media/CACHE/images/store/63/edinburgh-harry-potter5/85a65dab1fa4df8d28a84717d763060b.jpg",
				"full": "https://app.wegotrip.com/media/store/63/edinburgh-harry-potter5.jpg"
			}, {
				"id": 3706,
				"description": "",
				"cover": false,
				"preview": "https://app.wegotrip.com/media/CACHE/images/store/63/edinburgh-harry-potter4/f3ea1fe9ece6116785c2642e5d1d06c1.jpg",
				"full": "https://app.wegotrip.com/media/store/63/edinburgh-harry-potter4.jpg"
			}, {
				"id": 3707,
				"description": "",
				"cover": false,
				"preview": "https://app.wegotrip.com/media/CACHE/images/store/63/edinburgh-harry-potter2/00069e316780a12a05e9fe29470796e5.jpg",
				"full": "https://app.wegotrip.com/media/store/63/edinburgh-harry-potter2.jpg"
			}, {
				"id": 3708,
				"description": "",
				"cover": false,
				"preview": "https://app.wegotrip.com/media/CACHE/images/store/63/edinburgh-harry-potter1/258a9e78cf6b513b452db281665e801d.jpg",
				"full": "https://app.wegotrip.com/media/store/63/edinburgh-harry-potter1.jpg"
			}, {
				"id": 3709,
				"description": "",
				"cover": false,
				"preview": "https://app.wegotrip.com/media/CACHE/images/store/63/dsc09046-01/474dcdf956f198df97e1160da3a78450.jpeg",
				"full": "https://app.wegotrip.com/media/store/63/dsc09046-01.jpeg"
			}
		],
		"description": "Experience a little magic on a 2-hour walking tour of Edinburgh that is perfect for all Harry Potter fans. Learn all the stories and secrets behind the best selling books by J. K. Rowling in the city where she wrote them.\r\n\r\nVisit the original sites that provided the inspiration for Hogwarts and the characters who dwelled within its magical walls. Stroll along the High Street to see where Diagon Alley came to life and visit the graveyard where Lord Voldemort is buried. See the original Hogwarts School, and look at a virtual school assembly of its characters! You'll have a chance to prepare magical potions and taste butterbeer, visit the places where Joanne Rowling enjoyed to write her books and see her handprints immortalized in stone.\r\n\r\nThe tour will finish at a symbolic place — near the Balmoral Hotel where J. K. Rowling finished the final Harry Potter book.",
		"shortDescription": "Experience a little magic on a 2-hour walking tour of Edinburgh that is perfect for all Harry Potter fans. Learn all the stories and secrets behind the best selling books by J. K. Rowling in the city where she wrote them.\r\n\r\nVisit the original sites that provided the inspiration for Hogwarts and the characters who dwelled within its magical walls. Stroll along the High Street to see where Diagon Alley came to life and visit the graveyard where Lord Voldemort is buried. See the original Hogwarts School, and look at a virtual school assembly of its characters! You'll have a chance to prepare magical potions and taste butterbeer, visit the places where Joanne Rowling enjoyed to write her books and see her handprints immortalized in stone.\r\n\r\nThe tour will finish at a symbolic place — near the Balmoral Hotel where J. K. Rowling finished the final Harry Potter book.",
		"highlights": ["Find the place where Rowling wrote parts of the very first Harry Potter book", "Try the real butterbeer in \"The Dog House\"", "See where Diagon Alley came to life and visit the graveyard where Lord Voldemort is buried"],
		"distance": "4 km",
		"duration": "1.5 – 2 hours",
		"locale": "en",
		"city": {
			"id": 10,
			"name": "Edinburgh",
			"slug": "edinburgh"
		},
		"country": {
			"id": 2635167,
			"name": "United Kingdom",
			"slug": "united-kingdom"
		},
		"address": "253 High St",
		"startLocation": "Edinburgh City Chambers",
		"locationGeo": {
			"type": "Point",
			"coordinates": [-3.190297800000053, 55.9502415]
		},
		"finishAddress": "1 Princes St",
		"finishLocation": "Balmoral Hotel",
		"finishLocationGeo": {
			"type": "Point",
			"coordinates": [-3.1895759, 55.953025951082466]
		},
		"boundingCircle": {
			"coords": {
				"lng": -3.189956140072632,
				"lat": 55.9476448402917
			},
			"radius": 717.7591345862816
		},
		"price": 17.57,
		"exprice": 17.57,
		"currency": "$",
		"currencyCode": "USD",
		"defaultCurrency": {
			"id": 1,
			"rate": 1.0,
			"code": "EUR",
			"symbol": "€",
			"name": "Euro"
		},
		"discount": 0.0,
		"priceLevels": [{
				"id": 80,
				"label": "Adult",
				"description": "Age: 18+",
				"pricingCategoryId": "1",
				"price": 17.57
			}
		],
		"types": {
			"audioguide": true,
			"ar": true
		},
		"inclusions": ["Advice from a local about visiting an International Book Festival"],
		"exclusions": ["Entrance tickets to attractions — you can visit them on your own", "Headphones — you should bring your own"],
		"importantInfo": [],
		"rating": 5.0,
		"reviewsCount": 1,
		"ratingsCount": 1,
		"reviews": [{
				"name": "Karol",
				"text": "The dog house. Cons was a little mess with the technical side of the tour. But the support given solved issue.",
				"avatar": "",
				"rating": 5,
				"date": "2021-07-15 08:37:02"
			}
		],
		"tour": {
			"id": 63,
			"title": "Edinburgh: Harry Potter-Themed Tour & Audio Guide",
			"mediaSize": 43523102,
			"eventsCount": 26
		},
		"tickets": [],
		"accessCodes": [],
		"category": "Walking Tours",
		"categories": [{
				"id": 3,
				"title": "Theme Tours",
				"slug": "theme-tours"
			}, {
				"id": 2,
				"title": "Sightseeing Tours",
				"slug": "sightseeing-tours"
			}, {
				"id": 4,
				"title": "Family Friendly Tours",
				"slug": "family-friendly-tours"
			}
		],
		"subcategories": [{
				"id": 12,
				"title": "Movie & TV Tours",
				"slug": "movie-tv-tours"
			}, {
				"id": 4,
				"title": "City tours",
				"slug": "city-tours"
			}, {
				"id": 1,
				"title": "Walking Tours",
				"slug": "walking-tours"
			}
		],
		"attractions": [{
				"id": 61,
				"name": "Edinburgh Castle",
				"slug": "edinburgh-castle",
				"preview": "https://app.wegotrip.com/media/CACHE/images/world/Edinburgh-Castle/7678ca575bc2d9eaa43798006ae85a49.jpg",
				"itemsCount": 2
			}
		],
		"durationMin": 90,
		"durationMax": 120,
		"type": 1,
		"available": true,
		"published": true,
		"status": "approved",
		"author": {
			"avatar": "https://app.wegotrip.com/media/users/1/path32.png",
			"name": "WeGoTrip",
			"bio": "Better to see something once than hear about it a thousand times",
			"nickname": "wegotrip",
			"rating": 4.75,
			"ratingsCount": 100
		}
	}
}

Product reviews

GET /products/{ID}/reviews/

GET-parameters
Parameter Meaning Available values Example
page Paginator page In 1-pages from the response 1

Decoded response: in the data object in the results key there is an array of objects which represent reviews

{
	"data": {
		"count": 1,
		"pages": 1,
		"current": 1,
		"next": null,
		"results": [{
				"name": "Karol",
				"text": "The dog house. Cons was a little mess with the technical side of the tour. But the support given solved issue.",
				"avatar": "",
				"rating": 5,
				"date": "2021-07-15 08:37:02"
			}
		]
	}
}

Rendering the product card

This part is up to you. See how we made it in our store.

Use preview as the picture. By clicking the card redirect to our website.

Payments

You need slug and id from the product object and the city (see Getting list of products и Getting information about products) and SUB_ID or REFERER_ID.

1. Redirect to the product page in the store (recommended)

  • TravelPayouts URL https://wegotrip.com/${city-slug}-d${city-id}/${product-slug}-p${product-id}/?sub_id=${SUB_ID}
  • Directly WeGoTrip URL https://wegotrip.com/${city-slug}-d${city-id}/${product-slug}-p${product-id}/?coupon=${REFERER_ID}

An example for «Edinburgh: Harry Potter-Themed Tour & Audio Guide» product URL https://wegotrip.com/edinburgh-d10/edinburgh-harry-potter-tour-p63/?coupon=1005

  <a href="https://wegotrip.com/edinburgh-d10/edinburgh-harry-potter-tour-p63/?coupon=1005">
    More details
  </a>

2. Redirect to the checkout in the store

  • TravelPayouts URL https://wegotrip.com/checkout/${product-slug}-p${product-id}/booking/?sub_id=${SUB_ID}
  • Directly WeGoTrip URL https://wegotrip.com/checkout/${product-slug}-p${product-id}/booking/?coupon=${REFERER_ID}

An example for «Edinburgh: Harry Potter-Themed Tour & Audio Guide» product URL https://wegotrip.com/checkout/edinburgh-harry-potter-tour-p63/booking/?coupon=1005

  <a href="https://wegotrip.com/checkout/edinburgh-harry-potter-tour-p63/booking/?coupon=1005">
    Buy
  </a>

Cookies and rewards

After a user goes to our website using your link, your SUB_ID or REFERER_ID is stored in cookies for 30 days. The cookies prolongates if the user come back during this period.

If the user makes a purchase, it will be attached to your account. You will receive the reward when the travel date becomes and user downloads the tour into the app.

Testing and other questions

To test your integration and if you have any questions, write to support@wegotrip.com.

Updated at 25 Apr 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment