home > support > API > Marketplace API > PHP JSON repeater

Fork me on GitHub

TourCMS API - JSON Repeater

About the JSON Repeater

The JSON Repeater is designed to sit on a web server and provide a JSON/JSONP interface to the TourCMS XML API making JavaScript or other client development simpler. Only white listed fields are returned in the JSON so that commercially sensitive information is protected. Generally only the information that would be displayed on a website should be white listed, the downloaded code includes a large white list which can be shortened to reduce the volume of information sent to the clients via the repeater.

Current status

The code is very early, more of a quick proof of concept hack than a completed solution. That said it supports the Tour Search and Tour Show API methods, returns JSON / JSONP (supporting the default JQuery callback=? parameter for JSONP) and we also have a hosted version for use by those entering the THack event (available for the duration of the event).

TL;DR? Here are some examples

Examples are written in JavaScript using JQuery and hosted on JSFiddle.

THack attendees are welcome to use the above hosted version of this code, you do not need to download the PHP and install it on your own server unless you wish to use your own Marketplace Agent account and credentials. See Working examples above.

Querystring parameters

Generally the querystring parameters used should be as per the API Method you are calling (e.g. currently either Tour Search or Tour Show) however there are a few parameters specific to the JSON Repeater:

Parameter Notes
return Sets the content-type returned, only supported value is text (returns "text/plain"). Defaults to "application/json"
callback By default the API will return a JSON object, passing the callback parameter causes a JSONP response, the value being used as the callback function. If you are using JQuery's JSONP implementation you don't need to worry about this param.
channel The various TourCMS API methods pass the Channel ID (Identifier for a specific connected company/brand) in the request header, this is not possible with JSONP thus for the purposes of the JSON Repeater the channel can be provided in the querystring. This is used when showing a particular Tour (as Tour ID's are unique per channel, not system wide) and also when searching for Tours just from a specific channel. If searching all Tours/Hotels accross all connected channels then the channel ID can be left out (or passed as 0).

Licensing

The library is provided under an MIT license which allows you absolute flexibility in re-use and distribution, you may use the library in your own closed source or open source applications. If you would prefer to receive the library under another license please contact us.


Version history

0.1
Initial public release

More information