Requirements
URL: http://www.myupcoming.com/api
You will need:
- An account on the site. Register.
- An application id and key. Request this here.
XML or JSON
The API can return data in XML (default) or JSON. Specify the format using the fmt GET parameter, which can be set to xml or json. The API does not remember the chosen format, so the parameter needs to be passed in every request.
XML example:
<?xml version="1.0"?>
<root>
<status>
<code>200</code>
<message>OK</message>
</status>
<result>
<item>
<field name="id" isNull="1">1848</field>
<field name="title" isNull="1">dummy</field>
...
</item>
<item>
<field name="id" isNull="1">1849</field>
...
</item>
</result>
</root>
JSON example:
{
"status":{
"code":200,
"message":"OK"
},
"result":[
{
"id":"1848",
"title":"dummy",
...
},
{
"id":"1849",
...
}
]
}
Both formats consist of a status and result part. The status part contains a code (HTTP status code) and a message (will contain a message in case of an error). The result part contains the actual data that was requested.
Logging in
Your application needs to login before making API calls:
URL: http://www.myupcoming.com/api/login
These paramaters need to be passed in a POST request:
app-id: your application idemail: the email address you use to login in to the websitepwd: the password you use to login in to the websitefmt: optional, xml (default) or json
This will return a session id that will allow you to make requests. The id needs to be passed in each request. The id stays valid for 20 minutes.
Signing requests
Each API call needs to be sign with your key. (Your key must be kept private, never pass it in API calls.) This is done by taking and MD5 hash of the URL in combination with your key. The hash needs to be appended to the URL for the API call as a GET parameter with the name sign. Example in PHP:
$apiCall = 'http://www.myupcoming.com/api/events/organizer-events?session-id=your_session_id&org-id=organizer_id';
$key = 12345;
$signature = md5($apiCall . $key);
$apiCall .= '&sign=' . $signature;
Getting a list of events
http://www.myupcoming.com/api/events/organizer-events?session-id=your_session_id&org-id=organizer_id&sign=your_signature
or
http://www.myupcoming.com/api/events/organizer-events?session-id=your_session_id&org-email=organizer_email&sign=your_signature
Getting one event
http://www.myupcoming.com/api/events/event?session-id=your_session_id&event-id=event_id&sign=your_signature
Getting a list of ticket types
http://www.myupcoming.com/api/event-ticket-types?session-id=your_session_id&event-id=event_id&sign=your_signature
Getting a list of tickets
Parameter ticket-type-id is optional, if it is left out all tickets for the event will be returned. Use the optional parameter include-answers=1 to receive the answers for extra questions that are linked to the tickets.
http://www.myupcoming.com/api/events/event-tickets?session-id=your_session_id&event-id=event_id&ticket-type-id=ticket_type_id&sign=your_signature
Recipe: displaying the number of available tickets for an event
<?php
$domain = 'http://www.myupcoming.com';
// change settings here
$email = 'your email here';
$password = 'the password for the site here';
$apiId = 'your API id here';
$apiKey = 'your API key here';
$eventId = 'your event id here'; // check the URL for your event to find its id
// login
$loginUrl = $domain . '/api/login';
$ch = curl_init($loginUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'email' => $email,
'pwd' => $password,
'app-id' => $apiId,
'fmt' => 'json',
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// get session id and store
$result = curl_exec($ch);
curl_close($ch);
$json = json_decode($result);
$sessionId = $json->result->sessionId;
// get event info
$apiCallUrl = $domain . "/api/events/event?session-id=$sessionId&event-id=$eventId&fmt=json";
$signature = md5($apiCallUrl . $apiKey);
$apiCallUrl .= '&sign=' . $signature;
$json = json_decode(file_get_contents($apiCallUrl));
// var_dump($json);
print $json->result->numTicketsAvailable;
?>
Getting a list of venues
http://www.myupcoming.com/api/venues/owner-venues?session-id=your_session_id&owner-id=owner_id&sign=your_signature
or
http://www.myupcoming.com/api/venues/owner-venues?session-id=your_session_id&owner-email=owner_email&sign=your_signature
Getting a list of offers
http://www.myupcoming.com/api/offers/owner-offers?session-id=your_session_id&owner-id=owner_id&sign=your_signature
or
http://www.myupcoming.com/api/offers/owner-offers?session-id=your_session_id&owner-email=owner_email&sign=your_signature
Getting a list of offers from a venue
http://www.myupcoming.com/api/offers/venue-offers?session-id=your_session_id&venue-id=venue_id&sign=your_signature
Getting one offer
http://www.myupcoming.com/api/offers/offer?session-id=your_session_id&offer-id=offer_id&sign=your_signature
Validating an offer
http://www.myupcoming.com/api/offers/validate-offer?session-id=your_session_id&barcode=your-barcode&validation-code=your-validation-code&sign=your_signature