Create adaptive links using the API
You must use the API to create adaptive links for event tickets and boarding passes. See:
You can take advantage of adaptive links even when supporting a single platform; if a user on the unsupported platform attempts to install your pass, you can send the user to a landing page.
When creating the adaptive link, use ID null
for the second template, and make sure to include a value for landingPageUrl
.
Creating the adaptive link
You must have at least one Apple Wallet and one Google Wallet template to create an adaptive link.
Perform a one-time POST
API call to
https://wallet-api.urbanairship.com/v1/links/adaptive
, referring to your
template ID. Sample data
and JSON parameters are below.
{
"androidTemplateId": "610213",
"availablePasses": 100000,
"iosTemplateId": "581252",
"isPersonalized": "false",
"landingPageUrl": "https://airship.com",
"locationRadius": 10,
"maxResultLocations": 5,
"locations": [
{
"latitude": 45.5898,
"longitude": -122.5951,
"relevantText": "Welcome to Portland... Voodoo Donuts is near..."
},
{
"latitude": 37.7835926,
"longitude": -122.3982583,
"relevantText": "Hello Airship SF"
}
],
"payload": {
"externalId": null,
"fields": {
"offercode": {
"value": "MJ85SMR"
}
},
"headers": {
"barcodeAltText": {
"value": "MJ85SMR"
},
"barcode_value": {
"value": "MJ85SMR"
}
}
}
}
Creating passes from adaptive links using URL query parameters
You can generate passes directly from your adaptive link with a GET
call to https://wallet-api.urbanairship.com/v1/pass/adaptive/{adaptiveLinkId}
.
Request parameters may be appended to the base URL to add or update values on the generated pass. Some specialized query parameters are documented as part of the Adaptive Link API. In addition to these specialized parameters, you may provide a URL parameter as fieldName=value
for any field contained in the templates associated with the adaptive link.
For example, if you wanted to add an offer code, barcode, tags for time zone and location, and a member ID using an external ID, you could append URL query parameters to a base adaptive link URL as follows:
https://wallet-api.urbanairship.com/v1/pass/adaptive/QXynXTbMhS?offercode=AUGUST&barcode=A1234567&tags=PST~OR&exid=A1234567
You cannot personalize Google Wallet class
fields with unique values. Any field preceded by class
constitutes a class field. See Google Wallet Pass Verticals documentation for a full list of
class fields for each pass type.
Categories