Overview
API Documentation
Approach Guides provides a complete solution for inspiring, informing and converting your customers. Our purpose-built multimedia-content platform delivers hyper-relevant, personalized engagements at all touchpoints: email, website, social and mobile.
The RESTful API makes it easy. The following technical documentation describes the resources that make up the Approach Guides API v1.0
Authentication
To get started using the API, you will need an API Key and Secret. If you don't have any credentials, please contact partner@approachguides.com.
All API endpoints require basic HTTP Authentication with the API Key as the username, and the API Secret as the password. If you recieve 401 Authorization Failed error
on a request, the credentials you supplied were invalid.
Responses
All responses are returned in JSON and include an items
property which contains all of the data, and a meta
property which is explained below.
Response Status Codes
The API will provide a standard HTTP status code on each call, which will be one of the following.
Status Code | Description | 200 | The request was successful. |
---|
401, 403 | Authentication has failed, check your credentials. |
---|
422 | Unprocessable entity. You either sent too many parameters, or not enough. A detailed error message will be returned. |
---|
503 | Interval server error, try again later. If it persists, contact us to resolve this issue. |
---|
Meta Information
All responses contain a meta
property which contains the following values.
Property | Description | paginated | Whether the items are paginated or not. |
---|
count | The number of items on the current page. |
---|
current_page | The current page. |
---|
has_more_pages | Whether or not there are more pages of items. |
---|
last_page | Whether or not you are on the last page. |
---|
per_page | The number of items per page. |
---|
total | The total number of items for all pages. |
---|
Dates and Times
Some endpoints will also return created_at
and updated_at
properties which contain dates and times relating to when the item was created and when it was last updated. These are Atom formatted dates that include timezone, and can readily be parsed by all coding languages, including Javascript.
Sample code
Below is a simple example of how to consume the Approach Guides API with PHP
code. Note that your_api_key and your_api_secret should be replaced with your API credentials.
// Connect to API and parse data
$url = "https://your_api_key:your_api_secret@api.approachguides.com/v2/destinations";
$response = file_get_contents($url);
$data = json_decode($response);
// Output the data
var_dump($data);
Endpoints
Destinations
This endpoint returns all destinations.
Endpoint | Description | api.approachguides.com/v2/destinations | All of the destinations content could be associated with. |
---|
Example response
{
"items": [
{
"id": 1,
"parent_id": null,
"name": "Africa",
"label": "Africa",
"depth": 0,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-19T17:00:28+00:00"
},
{
"id": 2,
"parent_id": 1,
"name": "Botswana",
"label": "Africa > Botswana",
"depth": 1,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-21T13:21:51+00:00"
}
]
}
Languages
This endpoint returns all languages.
Endpoint | Description | api.approachguides.com/v2/languages | All of the languages content could be associated with. |
---|
Example response
{
"items": [
{
"id": 1,
"name": "English",
"created_at": "2016-08-19T17:00:29+00:00",
"updated_at": "2016-08-21T13:26:54+00:00"
}
]
}
Content
This endpoint returns all content available to you.
Endpoints
Endpoint | Description | api.approachguides.com/v2/content | All of the content. |
---|
Optional Parameters
Below are optional parameters that can be used to further tailor the returned data. Parameters should be added to the endpoint as GET parameters, for example, api.approachguides.com/v2/content?with=destinations,tags&languages=1
will return all content with destinations and tags where the language is equal to 1, which is English.
Important Note
In addition to the usual response data, we now return two new properties when you hit /v2/content
with ?collection=X
where X is one of your collection IDs.
- To use our analytics, simply swap the current url field:
content_url
for the new field: content_url_analytics
and analytics will start flowing into your dashboard. - To display individual content items such that they match the order assigned in “Collections” in the content portal, use the
position
field, which starts at 0 for the content displayed first and continues 1, 2, 3, etc.
Parameter | Description | with | Request content with relational data, options below, comma separated. Alternatively, pass all to request content with all related data. destinations languages subtitles tags all — this includes all available relational data.
Examples:
?with=destinations,tags — returns content with related destinations and tags.
?with=all — returns content with all related data. |
---|
updated_since | Request content created or updated on or after a date/time. This is useful for only fetching content that has been updated since your last call, and not having to pull all of the content every time. Examples:
?updated_since=2016-08-16 — returns content created or updated on or after 16th August 2016.
?updated_since=2016-08-21T13:26:54+00:00 — returns content created or updated on or after 16th August 2016 at 13:26:54 UTC. |
---|
destinations | Request content by destination id(s), comma separated. Use the destinations endpoint to obtain destination ids. Example:
?destinations=1,2 — returns content associated with destination ids 1 & 2. |
---|
tags | Request content by tag id(s), comma separated. Use the tags endpoint to obtain tag ids. Example:
?tags=1,2 — returns content associated with tag ids 1 & 2. |
---|
languages | Request content by language id(s), comma separated. Use the languages endpoint to obtain language ids. Example:
?languages=1,2 — returns content associated with languages ids 1 & 2. |
---|
collection | Request content by collection id. Use the collections endpoint to obtain a collections id. Note that this parameter must be passed if you want the content_url_analytics property to be returned in the response. Example:
?collection=1 — returns content associated with collection id 1. |
---|
Response data
Parameter | Description | title | The title of the content. |
---|
synopsis | The summary of the content. |
---|
lead_in | The site the content is hosted on. E.g. View on YouTube |
---|
author | The author of the content (typically associated with books and articles). |
---|
runtime | The length of audio and video content in minutes. |
---|
description | A compilation of the lead_in, synopsis, author and runtime parameters. (HTML) |
---|
type | The type ID of content. E.g. Books. Reference against the content types endpoint. |
---|
content_url | The external URL associated with content. |
---|
content_url_analytics (*) | An alternative to content_url that routes via our trvlnspr.es domain and tracks clicks on content. * Note that this property is only returned when using the optional collection GET parameter detailed above, and that this must be used if you wish to track click analytics. |
---|
level | The level of the content — Novice, Intermediate or Expert. |
---|
embed_code | The HTML embed code of the content media. |
---|
featured_image | The featured image of the content media. |
---|
languages | The languages the content is available in. |
---|
subtitles | If video content, the subtitles the content has available. |
---|
destinations | The destinations the content relates to. |
---|
tags | The tags the content is associated with. |
---|
Example response
{
"items": [
{
"id": 1,
"title": "Approach Guides for Istanbul",
"lead_in": "...",
"synopsis": "...",
"author": "...",
"runtime": "...",
"type_id": 1,
"content_url": "...",
"embed_type": "...",
"level": null,
"published_at": "2015-02-03T00:27:41+00:00",
"created_at": "2015-02-03T00:27:41+00:00",
"updated_at": "2016-08-21T13:26:52+00:00",
"featured_image": "...",
"embed_code": "",
"description": "...",
"type": "Books",
"languages": [
{
"id": 1,
"name": "English"
}
],
"subtitles": [],
"tags": [
{
"id": 1,
"tag": "Approach Guides"
},
{
"id": 2,
"tag": "Arts"
}
],
"destinations": [
{
"id": 122,
"name": "Turkey",
"label": "Middle East > Turkey"
},
{
"id": 124,
"name": "Istanbul",
"label": "Middle East > Turkey > Istanbul"
}
]
}
]
}
Content Types
This endpoint returns all content types.
Endpoint | Description | api.approachguides.com/v2/content-types | All of the content types that content could be associated with. |
---|
Response data
Parameter | Description | name | The content type name. |
---|
description | The content type description. |
---|
image | The content type image. |
---|
weight | The weight of the content type, used for weighting search results returned by the API. |
---|
Example response
{
"meta": {
"paginated": true,
"count": 11,
"current_page": 1,
"has_more_pages": false,
"last_page": 1,
"next_page_url": null,
"per_page": 15,
"prev_page_url": null,
"total": 11
},
"items": [
{
"id": 1,
"name": "Books",
"description": "Books & eBooks",
"image": "https:\/\/cdn.approachguides.com\/1\/tripreads-icon-category-books.jpg",
"weight": 9,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-28T09:24:49+00:00"
},
{
"id": 2,
"name": "Articles",
"description": "Articles & Academic Papers",
"image": "https:\/\/cdn.approachguides.com\/2\/tripreads-icon-category-articles.jpg",
"weight": 10,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-28T09:24:49+00:00"
},
{
"id": 3,
"name": "Online",
"description": "Online Sources & Blogs",
"image": "https:\/\/cdn.approachguides.com\/3\/tripreads-icon-category-online.jpg",
"weight": 5,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-28T09:24:49+00:00"
},
{
"id": 4,
"name": "Audio",
"description": "Podcasts & Music Playlists",
"image": "https:\/\/cdn.approachguides.com\/4\/tripreads-icon-category-audio.jpg",
"weight": 10,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-28T09:24:49+00:00"
},
{
"id": 5,
"name": "Kids",
"description": "Just for Kids",
"image": "https:\/\/cdn.approachguides.com\/5\/tripreads-icon-category-kids.jpg",
"weight": 1,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-28T09:24:49+00:00"
},
{
"id": 6,
"name": "Follow",
"description": "Who to Follow",
"image": "https:\/\/cdn.approachguides.com\/6\/tripreads-icon-category-follow.jpg",
"weight": 3,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-28T09:24:49+00:00"
},
{
"id": 7,
"name": "Map",
"description": "Get Your Bearings",
"image": null,
"weight": 0,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-19T17:00:28+00:00"
},
{
"id": 8,
"name": "Videos",
"description": "Videos that Set the Stage",
"image": "https:\/\/cdn.approachguides.com\/7\/tripreads-icon-category-film.jpg",
"weight": 10,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-28T09:24:49+00:00"
},
{
"id": 9,
"name": "Experiences",
"description": "On-Location Experiences",
"image": "https:\/\/cdn.approachguides.com\/8\/tripreads-icon-category-recommended.jpg",
"weight": 1,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-28T09:24:49+00:00"
},
{
"id": 10,
"name": "Films",
"description": "Quintessential Cinema",
"image": "https:\/\/cdn.approachguides.com\/9\/tripreads-icon-category-film.jpg",
"weight": 5,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-28T09:24:49+00:00"
},
{
"id": 11,
"name": "Apps",
"description": "Mobile Applications",
"image": "https:\/\/cdn.approachguides.com\/10\/tripreads-icon-category-app.jpg",
"weight": 7,
"created_at": "2016-08-19T17:00:28+00:00",
"updated_at": "2016-08-28T09:24:49+00:00"
}
]
}
Collections
This endpoint returns all collections.
Endpoint | Description | api.approachguides.com/v2/collections | All of the collections. |
---|
Response data
Parameter | Description | alt_id | The unique public ID of the collection, used in landing pages and embeds. |
---|
user_id | The user ID that the collection belongs to. |
---|
folder_id | The folder ID that the collection belongs to, could be null. |
---|
type | The collection type. |
---|
name | The collection name. |
---|
code | The code(s) associated with the collection, separated by spaces. |
---|
content_count | The number of content items the collection has. |
---|
landing_page_url | The URL to the collection's landing page. |
---|
Example response
{
"meta": {
"paginated": true,
"count": 1,
"current_page": 1,
"has_more_pages": false,
"last_page": 1,
"next_page_url": null,
"per_page": 15,
"prev_page_url": null,
"total": 1
},
"items": [
{
"id": 10,
"alt_id": "urOXY9aR",
"user_id": 1,
"folder_id": null,
"type": "partner",
"name": "Les Espanol",
"code": "",
"content_count": 5,
"landing_page_url": "https:\/\/explore.approachguides.com\/collections\/123\/2298\/DNWaLw7o",
"created_at": "2016-08-29T10:47:32+00:00",
"updated_at": "2017-01-18T09:46:34+00:00"
}
]
}