Javascript SDK for the Ticketmaster Open Platform.
Aims to wrap the Ticketmaster API with coverage for all Open Platform endpoints, featuring:
npm install --save ticketmaster@<version>
NOTE: We heavily use semantic versioning, and actively introduce breaking changes across MAJOR version changes. To avoid any breaking changes being introduced inadvertently, you should lock this package at a specific version using the npm command above, and upgrade explicitly.
For use in the browser-based client-side JS applications, a dist/ folder exists for each release. Releases can be found @ https://github.com/ticketmaster-api/sdk-javascript/releases.
git clone --branch <version> git@github.com:ticketmaster-api/sdk-javascript.git
For browser usage there are two files in dist/ folder
./dist/ticketmaster-[version].js (raw with source-maps)
./dist/ticketmaster-[version].min.js (minified)
Include one of them in to your project:
...
<script src="https://github.com/ticketmaster-api/sdk-javascript/raw/master/ticketmaster-[version].js"></script>
<script src="https://github.com/ticketmaster-api/sdk-javascript/raw/master/ticketmaster-[version].min.js"></script>
...
Use global variable ticketmaster to make an API call (name can be changed in webpack settings during rebuild):
ticketmaster('your-api-key').discovery.v2.event.all()
.then(function(result) {
// "result" is an object of Ticketmaster events information
});
Require the package and make an API call:
var ticketmaster = require('ticketmaster');
ticketmaster('your-api-key').discovery.v2.event.all()
.then(function(result) {
// "result" is an object of Ticketmaster events information
});
Alternative syntax if you are only interested in a subset of the API:
var EventAPI = require('ticketmaster').discovery.v2.event;
EventAPI('your-api-key').all()
In case you want to build your own bundle for client
1
. Clone this repository
git clone git@github.com:ticketmaster-api/sdk-javascript.git
2
. install dependencies
npm install
3
. Run npm script:
npm run-script dev
npm run-script prod
npm run-script win-prod
Be aware: no .catch() method provided! You should write it by your own.
(provided only for sets which are result of .all() type methods)
properties:
-result.items
- Array of Ticketmaster event information.
-result.page
- Additional general information object.
methods:
-result.getPage(index)
- Promise which returns a new Result object.
-result.nextPage()
- Promise which returns a new Result object. Can take additional param - step (1 by default).
-result.previousPage()
- Promise which returns a new Result object. Can take additional param - step (1 by default).
-result.records()
- returns an Array of this page's records
-result.count()
- returns the total count of items
-result.isLastPage()
- returns a Boolean if current Result is the last page
npm test
Currently supports the following endpoints:
The goal is to implement all endpoints available @ http://developer.ticketmaster.com/. Pull Requests gladly accepted!
Maintainers can cut a new release:
npm version <new_version>
This will build, tag, push to git, and push the build folder to npm.
[internal only] Find us in #open-platform on Ticketmaster Slack!