Create a new Pass from a pre-defined Template with the given keys/values pairs. In the Pass' json you can use these shortcuts:

Examples

curl -i -d 'pass={"serial_number":"1234567", "gate":"53", "departure":"2012-12-18T14:34:10-02:00"}' https://api.passdock.com/api/v1/templates/106/passes?api_token=75778a65dfdae310a107d2ef0bbd3780
curl -i -H "Content-Type: application/json" -d '{"pass":{"serial_number":"1234567", "gate":"53", "departure":"2012-12-18T14:34:10-02:00"}}' https://api.passdock.com/api/v1/templates/106/passes?api_token=75778a65dfdae310a107d2ef0bbd3780
curl -i -d 'pass={"redeemed":false,"serial_number":"1234567", "gate":"53", "departure":"2012-12-18T14:34:10-02:00"}' https://api.passdock.com/api/v1/templates/106/passes?api_token=75778a65dfdae310a107d2ef0bbd3780
curl -i -d 'debug=true&pass={"serial_number":"4567891", "bar":{"message":"QRRSNDKAIUDS923", "altText":"QRRSNDKAIUDS923"}, "gate":{"value":"53"},"departure":"2012-11-14T08:12:19-08:00"}' https://api.passdock.com/api/v1/templates/106/passes?api_token=75778a65dfdae310a107d2ef0bbd3780
curl -i -d 'debug=true&pass={"serial_number":"7891234", "relevance":{"locations":[{"latitude":12.122342, "longitude":64.123353}]}, "gate":{"value":"98"},"departure":"2012-11-14T08:12:19-08:00"}' https://api.passdock.com/api/v1/templates/106/passes?api_token=75778a65dfdae310a107d2ef0bbd3780
curl -i -d 'pass={"serial_number":"1234567", "gate":"53", "departure":"2012-12-18T14:34:10-02:00"}&thumbnail={"filename":"test.png","data":"THE_BASE_64_ENCODED_IMAGE"}' https://api.passdock.com/api/v1/templates/106/passes?api_token=75778a65dfdae310a107d2ef0bbd3780

Supported Formats

json

Success Response:

201 Good Request
OR 200 Good Request
              {
        "family_id": 217,
        "id": 314,
        "web_token": "5d16ecabb1d961a3aecd9eeaa2ddec9f45d43875",
        "download": "https://api.passdock.com/passes/217/5d16ecabb1d961a3aecd9eeaa2ddec9f45d43875.pkpass"
      }
          
OR 200 Good Request with Debug Enabled
              {
      "auxiliary": [
        {
          "changeMessage": "Departure time changed to %@",
          "dateStyle": "PKDateStyleMedium",
          "key": "departure",
          "label": "DEPARTURE",
          "timeStyle": "PKDateStyleMedium",
          "value": "2012-12-18T14:34:10-02:00"
        }
      ],
      "back": [
        {
          "changeMessage": "",
          "key": "passport",
          "label": "PASSPORT",
          "value": ""
        }
      ],
      "bar": {
        "format": "PKBarcodeFormatQR",
        "message": "",
        "messageEncoding": "iso-8859-1"
      },
      "created_at": "2012-10-18T09:40:27Z",
      "custom": [
        {
          "transitType": "PKTransitTypeAir"
        }
      ],
      "download": "https://api.passdock.com/passes/199/cd4bf0e77e1c619ed55d78f5f2ead787b7c689f9.pkpass",
      "family_id": 106,
      "header": [
        {
          "changeMessage": "Gate changed to %@",
          "key": "gate",
          "label": "GATE",
          "value": "53"
        }
      ],
      "id": 202,
      "primary": [
        {
          "changeMessage": "Departure changed in %@",
          "key": "from",
          "label": "FROM",
          "value": ""
        },
        {
          "changeMessage": "Destination changed to %@",
          "key": "to",
          "label": "TO",
          "value": ""
        }
      ],
      "relevance": {
      },
      "secondary": [
        {
          "changeMessage": "Passenger name changed to %@",
          "key": "name",
          "label": "NAME",
          "value": ""
        }
      ],
      "serial_number": "1234567",
      "updated_at": "2012-10-18T09:40:27Z",
      "visual": {
        "backgroundColor": "rgb(237,184,61)",
        "foregroundColor": "rgb(255,255,255)",
        "labelColor": "",
        "logoText": "Passdock Airways"
      },
      "web_token": "36eb5647504035593388c01189089c0512561268"
    }
          

Errors

400 Bad Request.
401 Unauthorized
420 Key Not Found In The Template
421 Missing serial number
422 Wrong Field Format

Params

Param name Description
template_id
required

Template ID


Value: Must be Fixnum
api_token
required

Your Passdock API key


Value: Must be String
pass
required

A JSON dictionary containing the pass keys and values


Value: Must be a Hash
pass[serial_number]
required

The serial number for the Pass, must be unique and cannot be changed


Value: Must be String
pass[redeemed]
optional

If the Pass has been redeemed or not.


Value: Must be one of: true, false.
pass[KEY]
optional

The desired keys that are present in the template and left empty.


Value: Must be a Hash
pass[KEY][label]
optional

The label for the field, usually placed above the value.


Value: Must be String
pass[KEY][value]
optional

The value of the field, usually placed below the label.


Value: Must be String
pass[KEY][changeMessage]
optional

The change message that will be shown in the lock screen and as notification when the value for the field is changed remotely.


Value: Must be String
pass[bar]
optional

An hash containing the Bar Section informations


Value: Must be a Hash
pass[bar][message]
optional

The message to be put in the 2D code


Value: Must be String
pass[bar][altText]
optional

The alternative text that will be put below the bar code.


Value: Must be String
pass[relevance]
optional

An hash containing the relevance informations like date, time and positions.


Value: Must be a Hash
pass[relevance][locations]
optional

Array of locations where the pass will appear on the lockscreen


Value: Must be a Hash
pass[relevance][locations][latitude]
required

Latitude


Value: Must be String
pass[relevance][locations][longitude]
required

Longitude


Value: Must be String
pass[relevance][locations][altitude]
optional

Altitude


Value: Must be String
pass[relevance][locations][relevantText]
optional

Text that will appear on the lockscreen when the place is reached.


Value: Must be String
pass[relevance][relevantDate]
optional

Date and Time when the pass will appear on the lockscreen. Use ISO8601 format.


Value: Must be String
thumbnail
optional

Thumbnail image for the Pass, can be set only if the category is Event Ticket and Generic (kind_id = 2 or 5).


Value: Must be a Hash
thumbnail[filename]
required

Name of the file.


Value: Must be String
thumbnail[data]
required

Content of the image in base64 format.


Value: Must be String
debug
optional

You get in response a JSON with the created object.


Value: Must be one of: true, false.
errors
optional

If an error occurs you get the messages and not only the code.


Value: Must be one of: true, false.