API Examples

Authentication API

Get authentication token

curl --verbose --cert xyzzy.crt --key xyzzy.key \
https://test1.mobileticket.se/api/v1/auth/xyzzy

Device API

Get device key

curl --verbose -X POST --data @- \
--header "Content-Type: application/json" \
https://test1.mobileticket.se/api/v1/device/key <<JSON
{"did": "MY_DEVICE_ID"}
JSON

Get current KDK set

curl --verbose -X GET \
--header "X-BoB-AuthToken: MY_AUTH_TOKEN" \
https://test1.mobileticket.se/api/v1/device/kdk

Ticket API

Issue ticket

curl --verbose -X POST --data @- \
--header "Content-Type: application/json" \
--header "X-BoB-AuthToken: MY_AUTH_TOKEN" \
https://test1.mobileticket.se/api/v1/ticket <<JSON
{
"manifestMtbTemplate": "MANIFEST_BASE64URL",
issueMtb: True
}
JSON

Get ticket bundle

curl --verbose -X POST --data @- \
--header "Content-Type: application/json" \
--header "X-BoB-AuthToken: MY_AUTH_TOKEN" \
https://test1.mobileticket.se/api/v1/ticketbundle <<JSON
{
"ticketIds": [ "TICKET1", "TICKET2", "..."]
}
JSON

Get ticket events

curl --verbose -X GET \
--header "X-BoB-AuthToken: MY_AUTH_TOKEN" \
https://test1.mobileticket.se/api/v1/ticket/TICKET_ID/event

Validation API

Submit validation event

curl ––verbose -X POST --data @- \
--header "Content-Type: application/json" \
--header "X-BoB-AuthToken: MY_AUTH_TOKEN" \
https://test1.mobileticket.se/api/v1/validation <<JSON
{
    'time': '2016-11-07T13:49:33.638462Z'
'eventType': 'validation',
'eventResult': 6,
'localEventId': 'b920d3e2-b1a4-4157-8bfd-c36c2de1fedb',
'ticketId': '57e53ddd731adf5bf07d2c12'
}
JSON

Get blacklist

curl --verbose -X GET \
--header "X-BoB-AuthToken: MY_AUTH_TOKEN" \
https://test1.mobileticket.se/api/v1/blacklist?blacklistEntryId=0

Product API

Get product from-to

curl --verbose -X GET \
--header "X-BoB-AuthToken: MY_AUTH_TOKEN" \
"https://test1.mobileticket.se/api/v1/product?originLocation=7411233&destinationLocation=7417164&travellerCategoryId=a"

Get product for specific zones

curl --verbose -X POST --data @- \
--header "Content-Type: application/json" \
--header "X-BoB-AuthToken: MY_AUTH_TOKEN" \
https://test1.mobileticket.se/api/v1/product <<JSON
{
"group": {
"groupType": "zone",
"groupIds": ["820", "821"]
},
"fareCategoryIds": ["day"],
"productCategoryIds": ["single"],
"travellerCategoryIds": ["a"]
}
JSON

Get product for route

curl --verbose -X POST --data @- \
--header "Content-Type: application/json" \
--header "X-BoB-AuthToken: MY_AUTH_TOKEN" \
https://test1.mobileticket.se/api/v1/product <<JSON
{
"route": [
{"stopId": "7417164"},
{"stopId": "7411233"},
{"stopId": "7422840"}
],
"fareCategoryIds": ["day"],
"productCategoryIds": ["single"],
"travellerCategoryIds": ["a"]
}
JSON