Google Passes Only

Operations that apply only to Google Wallet passes.

Add message to Google Pass

Add messages to Google Wallet passes.

Jump to examples ↓

POST /pass/{passId}/message

Security:

Request headers:

  • Api-Revision stringREQUIRED
    The particular API revision you want to use. In general, this is 1.2.

    Possible values: 1.2

Path parameters:

  • passId stringREQUIRED
    The Id of the Google Pass you want to apply messages to.

Request body:

A valid request contains one message for the pass.

  • Content-Type: application/json

    OBJECT PROPERTIES
    • body string

      The message body text.

    • endTime object

      The date-time when the notification will end. If you do not set an end time, the notification displays indefinitely.

      OBJECT PROPERTIES
      • date string
    • header string

      The header text for the message

    • messageType string

      Use expirationNotification to warn users of expiring messages, and text for all other notifications. expirationNotification is based on the start value in the displayInterval; the maximum display interval is 30 days from now. If the expiration start date is more than 30 days from now, the message will not appear until the 30-day mark.

      Possible values: expirationNotification, text

    • startTime object

      The date-time when the notification will begin appearing to users.

      OBJECT PROPERTIES
      • date string

Responses

  • 200

    A successful response returns details for the added message.

    • Content-Type: application/json

      Information about messages associated with specified Google Wallet passes.

      OBJECT PROPERTIES
      • body string

        The body of the message.

      • createdAt string

        The date and time when the item was created.

      • header string

        The header for the message.

      • messageType string

        The type of message.

        Possible values: expirationNotification, text

      • updatedAt string

        The date and time when the item was last updated.

  • 404

    The pass ID does not exist.

Examples

Example request

POST /v1/pass/mypass/message HTTP/1.1
Authorization: Basic <authorization string>
Content-Type: application/json

{
   "body":"wallet object expires soon",
   "header":"expires",
   "startTime": "2018-06-03T21:10:00.000Z",
   "endTime": "2018-06-05T21:50:00.000Z",
   "messageType":"expirationNotification"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "header": "expires",
   "body": "wallet object expires soon",
   "startTime": "2018-06-03T21:10:00.000Z",
   "endTime": "2018-06-05T21:50:00.000Z",
   "createdAt": "2021-08-18T23:25:05.075Z",
   "updatedAt": "2021-08-18T23:25:05.075Z",
   "messageType": "expirationNotification"
}

Add message to Google Pass with external ID

Add messages to Google Wallet passes.

Jump to examples ↓

POST /pass/template/{templateId}/id/{passExternalId}/message

Security:

Request headers:

  • Api-Revision stringREQUIRED
    The particular API revision you want to use. In general, this is 1.2.

    Possible values: 1.2

Path parameters:

  • templateId stringREQUIRED
    The template of the Google Pass that you want to apply messages to.
  • passExternalId stringREQUIRED
    The external ID of the Google Pass you want to apply messages to.

Request body:

A valid request contains one message for the pass.

  • Content-Type: application/json

    OBJECT PROPERTIES
    • body string

      The message body text.

    • endTime object

      The date-time when the notification will end. If you do not set an end time, the notification displays indefinitely.

      OBJECT PROPERTIES
      • date string
    • header string

      The header text for the message

    • messageType string

      Use expirationNotification to warn users of expiring messages, and text for all other notifications. expirationNotification is based on the start value in the displayInterval; the maximum display interval is 30 days from now. If the expiration start date is more than 30 days from now, the message will not appear until the 30-day mark.

      Possible values: expirationNotification, text

    • startTime object

      The date-time when the notification will begin appearing to users.

      OBJECT PROPERTIES
      • date string

Responses

  • 200

    A successful response returns details for the added message.

    • Content-Type: application/json

      Information about messages associated with specified Google Wallet passes.

      OBJECT PROPERTIES
      • body string

        The body of the message.

      • createdAt string

        The date and time when the item was created.

      • header string

        The header for the message.

      • messageType string

        The type of message.

        Possible values: expirationNotification, text

      • updatedAt string

        The date and time when the item was last updated.

  • 404

    The pass or template ID does not exist.

Examples

Example request

POST /v1/pass/template/123/id/mypass/message HTTP/1.1
Authorization: Basic <authorization string>
Content-Type: application/json

{
   "body":"wallet object expires soon",
   "header":"expires",
   "startTime": "2018-06-03T21:10:00.000Z",
   "endTime": "2018-06-05T21:50:00.000Z",
   "messageType":"expirationNotification"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "header": "expires",
   "body": "wallet object expires soon",
   "startTime": "2018-06-03T21:10:00.000Z",
   "endTime": "2018-06-05T21:50:00.000Z",
   "createdAt": "2021-08-18T23:25:05.075Z",
   "updatedAt": "2021-08-18T23:25:05.075Z",
   "messageType": "expirationNotification"
}

Get messages for Google Pass

Returns an array of messages associated with the specified pass.

Jump to examples ↓

GET /pass/{passId}/message

Security:

Request headers:

  • Api-Revision stringREQUIRED
    The particular API revision you want to use. In general, this is 1.2.

    Possible values: 1.2

Path parameters:

  • passId stringREQUIRED
    The Id of the Google Pass you want to get messages from.

Responses

  • 200

    A successful response returns details for the added messages.

    • Content-Type: application/json
      OBJECT PROPERTIES
      • messages array[object]

        An array of messages associated with the pass.

  • 404

    The pass ID does not exist.

Examples

Example request

GET /v1/pass/mypass/message HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "messages": [
      {
         "header": "expires",
         "body": "wallet object expiring soon",
         "createdAt": "2019-03-05T23:11:29.000Z",
         "updatedAt": "2019-03-05T23:11:29.000Z",
         "messageType": "expirationNotification"
      }
   ]
}

Get messages for Google Pass with external ID

Returns an array of messages associated with the specified pass.

Jump to examples ↓

GET /pass/template/{templateId}/id/{passExternalId}/message

Security:

Request headers:

  • Api-Revision stringREQUIRED
    The particular API revision you want to use. In general, this is 1.2.

    Possible values: 1.2

Path parameters:

  • templateId stringREQUIRED
    The template of the Google Pass that you want to get messages from.
  • passExternalId stringREQUIRED
    The external ID of the Google Pass you want to get messages for.

Responses

  • 200

    A successful response returns details for the added messages.

    • Content-Type: application/json
      OBJECT PROPERTIES
      • messages array[object]

        An array of messages associated with the pass.

  • 404

    The pass or template ID does not exist.

Examples

Example request

GET /v1/pass/template/123/id/mypass/message HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "messages": [
      {
         "header": "expires",
         "body": "wallet object expiring soon",
         "createdAt": "2019-03-05T23:11:29.000Z",
         "updatedAt": "2019-03-05T23:11:29.000Z",
         "messageType": "expirationNotification"
      }
   ]
}

Save to Google Wallet

Creates a pass from the specified template and returns code for a “Save to Google Wallet” button. Clicking or tapping this button installs the pass.

Jump to examples ↓

POST /pass/{templateId}/saveToWallet

Request headers:

  • Api-Revision stringREQUIRED
    The particular API revision you want to use. In general, this is 1.2.

    Possible values: 1.2

Path parameters:

  • templateId stringREQUIRED
    The id of the template you want to generate a “Save to Google Wallet” button for.

Request body:

The request is much like creating a pass with the addition of functions to perform upon success or failure.

  • Content-Type: application/json

    OBJECT PROPERTIES
    • externalId string

      An external identifier for the pass that you might want to use to update the pass in the future.

    • fields object
    • onFail string

      A javascript function that you want to be called when a user

    • onSuccess string

      A javascript function that you want to be called when a user successfully adds the pass to Google Wallet.

    • tag string

      A single tag you want to add to the pass.

Responses

  • 200

    A response includes the javascript for a “Save to Google Wallet” button.

Examples

Example request

POST /v1/pass/123/saveToWallet HTTP/1.1
Content-Type: application/json
Authorization: Basic <Base64 key>
Api-Revision: 1.2

 {
    "fields": {
       "Points": {
       "value": "600"
       }
    },
    "tag": "abc",
    "externalId": "UserName",
    "onSuccess": "mySuccessFunc()",
    "onFail": "myFailureFunc()"
 }

Response

<script src="https://apis.google.com/js/plusone.js" type="text/javascript"></script>
<script type="text/javascript">
function urban_airship_callback(path) {
   var script = document.createElement('script');
   script.src = path
   document.getElementsByTagName('head')[0].appendChild(script);
}
var successHandler = function (params) {
   urban_airship_callback('https://wallet-api.urbanairship.com/v1/card/register/2931580989855247863.31885_34ab7304-0148-407f-9e4a-69ae30c1efd1')
}
var failureHandler = function (params) {
   urban_airship_callback('https://wallet-api.urbanairship.com/v1/card/register/2931580989855247863.31885_34ab7304-0148-407f-9e4a-69ae30c1efd1')
}
</script>
<g:savetowallet
   jwt="eyJhbGciOiJSUzI1NiJ9..."
   onsuccess="mySuccessFunc()"
   onfailure="myFailureFunc()" size="small" theme="gray">
</g:savetowallet>