Media
The Media API provides photos and videos for Sygic Travel Places.
Place thumbnails & main media
Basic place-thumbnail URLs are included in the /places/list
response using the thumbnail_url
property. The photo has a fixed size of 150x150 pixels and can be used for small thumnails in the user interface.
When displaying a larger thumbnail or a cover photo, the main media from the place' details should be used. Main media are included in the /places/{id}
response under the main_media
property. The main media object can contain multiple media
suitable for different aspect ratios. The aspect ratio suitability information is stored in the usage
object specifying the most suitable media ID for square
, portrait
, landscape
, and video_preview
fromats.
Get place gallery
Many places have more media than just cover photos or videos. The Media API provides access to the complete media gallery.
Let's fetch the media gallery for the Eiffel Tower:
GET https://api.sygictravelapi.com/1.0/en/places/poi:530/media
You will get a list of photos and videos together with the related metadata. To display a photo or a video, take the url_template
property and replace the {size}
wildcard with the dimensions you need. For 800x600px dimensions the URL will be as follows:
- https://media-cdn.sygictraveldata.com/media/800x600/612664395a40232133447d33247d3832343139393830 - image will be cropped.
- https://media-cdn.sygictraveldata.com/media/800x600nc/612664395a40232133447d33247d3832343139393830 - no crop, image will fit to 800x600px.
- https://media-cdn.sygictraveldata.com/media/800x600nc-fill/612664395a40232133447d33247d3832343139393830 - no crop, image will fill 800x600px.
Attribution
When displaying main media or a gallery, an attribution must be icluded on the same page where the photo is displayed. The attribution information is wrapped in the media response under the attributon
object. Detailed instrucions on how to display attributions properly are available in our full API Specification.
For the Eiffel Tower photo used above the attributon
object contains the following data:
{
"title": "The Eiffel Tower, Paris",
"title_url": "http://commons.wikimedia.org/wiki/File:The_Eiffel_Tower.JPG",
"author": "Kuldip Patel",
"author_url": "http://commons.wikimedia.org/wiki/User:Kuldip_iitk",
"license": "CC BY 3.0",
"license_url": "http://creativecommons.org/licenses/by/3.0",
"other": null
}
The attribution then should be displayed as follows:
- Previous article: Places
- Next article: References