Overview
The Off-Street Payment API is used in conjunction with the Off-Street Parking API to facilitate an Off-Street Parking transactions from end-to-end — from identifying available parking resources to making a reservation with a specific resources.
The Off-Street Payments API may be used to request metadata on available parking products, make a reservation for a specific product and time, and complete a payment transaction for a product.
A typical workflow would be:
Off-Street Parking | 1. Request /lots filtered by geography, availability, etc. Request lot data Receive {lot} metadata - address, rates, occupancy, reviews, etc. |
GET /lots |
Off-Street Payments API | 2. Request product data Request available /products for a given lot Receive {products} metadata - affiliate, price, inventory, availability, type |
GET /products |
3. Create a new reservation Request to create a /reservation for a given product Receive {reservations} metadata - receipt, redemption/QR code, arrival instructions |
POST /reservations |
|
4. Request reservation data (optional) Request pending or historical /reservations Receive {reservations} metadata - receipt, redemption/QR code, arrival instructions |
GET /reservations |
Usage
As part of the end-to-end Off-Street Parking workflow, the Off-Street Payments API is complete a parking reservation for a specific lot. The API is used to:
- determine the available reservation products matching a given entry time criteria
- to make a parking reservation for a given facility/lot, including the payment transaction
Product Queries
Product queries are made for a specific lot
or f_id
. Results will be
returned as a list of parking products each with a unique
pk_reservation_product
. The resolution of the API is as specific as the input
parameters give. A default response will include a generic rate and a generic
list of days available. If an entry date and time is passed, an estimated rate
and availability for the day will be returned for each product. If an entry
date and time and a desired duration are provided, the API will return the
exact rate and availability.
Reservation Creation
For a given parking product, specified by its pk_reservation_product
, a
reservation can be created and paid for via a properly authenticated POST
request to the API. Reservations can be updated via a properly authenticated
PUT request. Existing reservations can also be queried.
Authentication
Successful requests to the Off-Street Payments API requires API-level proper authentication. The Off-Street Payments API supports two API-level authentication methods:
- an access token-based method in which a client will use an
app_id
and anapp_key
to request a 24-houraccess_token
- a legacy hashed request in which a client uses a hashed string created using
request data and an
api_key
to authenticate each request
Additionally, requests to create a reservation on behalf of a user will require User-level authentication in order to create the request. The Off-Street Payments API supports two User-level authentication methods:
- Session/Cookie-based authentication
- Basic HTTP Authentication i.e. username/password
Interface
Available reservation products will be accessible via https://parking-api.inrix.com/product.
Query operators are passed to the API via HTTPS/1.1 GET requests.
GET requests will always return a response payload. In the event that there are no available Products, the payload will be an empty list as defined below.
The system supports deflate/gzip encodings which are highly recommended to reduce bandwidth usage.
Making a reservation can be achieved via https://parking-api.inrix.com/reservation through HTTPS/1.1 POST requests.
Data Formats
All responses are in the JSON format (RFC 7159, ECMA-404).
JSONP calls are supported with the additional of a callback
parameter to
the URL.
API-Level Authentication
ACCESS TOKEN-BASED AUTHENTICATION
Access Token-based authentication requires two request.
- Make a request from the access token endpoint using an
app_id
and anapp_key
to request a 24-houraccess_token
. The following is a simple Python script for requesting anaccess_token
:
import hashlib, hmac, requests
token_request_url = "https://uas-api.beta.inrix.com/v1/AppToken"
parkme_test_app_id = "#YOUR_APP_ID#"
parkme_test_app_key = "#YOUR_APP_KEY#"
key_to_hash = parkme_test_app_id + '|' + parkme_test_app_key
hash_key = hashlib.sha1(key_to_hash).hexdigest()
uas_token_url = token_request_uri + \
"?appId={}&hashToken={}".format(app_id, hash_key)
response = requests.get(uas_token_url, verify = False)
json_response = response.json()
uas_token = json_response.get('result').get('token')
print(uas_token)
- Use the access_token to make your requests, e.g.
https://parking-api.inrix.com/product?f_id=#LOT#&accesstoken=#ACCESSTOKEN#
HASHED REQUEST + API KEY STRING
The Off-Street Payments API will continue to support a legacy authentication technique in which request information and an api key are hashed as a single string to create a request specific authentication key. The following is an example of creating an authenticated request in Python:
import base64, datetime, hashlib, requests
def create_signifier_string(signifier_list):
return '|'.join([str(each) for each in signifier_list])
def create_chk_hash(signifier_list, api_key):
signifier_string = '|'.join(
[str(each) for each in signifier_list])
encryption_string = str.encode(signifier_string + api_private_key)
chk_digest = hashlib.md5(encryption_string).hexdigest()
return chk_digest
entry_dt = datetime.datetime.now()
entry_dt = datetime.datetime.now()
pub_id = '#PUB_ID'
api_private_key = '#API_KEY'
point_and_rad = [-118.5, 34,2000]
params = {
'entry_dt': entry_dt.strftime('%Y-%m-%dT%H:%M'),
'duration' : 60,
'f_id' : create_signifier_string(available_f_ids),
'pub_id' : pub_id,
'chk' : create_chk_hash(point_and_rad, api_private_key),
'pt' : create_signifier_string(point_and_rad)
}
response = requests.get('https://parking-api.inrix.com/product/',
params=params)
print(response.json()['ProductCount'])
products = response.json()['Products']
print(products)
Product API
Resources are the objects available through the API, and are accessed via
URLs. Use two base URLs per resource – one for the collection, one for a
specific resource in the collection. One of lot
or f_id
is required.
/product/?f_id=22604 | All available reservation products for lot with given (specific) id |
Optional Parameters
Note: The resolution of the API is as specific as the input parameters give. For example: If no
entry_dt
is provided, the API will return a generic rate and a generic list of days available. If anentry_dt
is provided but notduration
, the API will provide an estimated rate and availability for the day. If bothentry_dt
and durations are provided, the API will return the exact rate and availability.
Name | Data Type | Description | Default Value |
---|---|---|---|
entry |
string | Entry date and time specified as an ISO-Extended UTC DateTime in the form | Now |
duration |
int | Number of minutes that the product should cover. Duration can be a pipe-delimited list for multiple queries. | N/A |
Response
{
"ProductCount": 1,
"Products": [
{
"pk_reservation_product": "b356bf2f-571e-4536-a10d-ad036c751134",
"name": "One California Plaza",
"promo_text": null,
"rates": [
22.6
],
"max_duration": 120,
"start_time": "11:00pm",
"end_time": "1:00am",
"days_available": {
"2018-10-12": 200
},
"service_fee": 1,
"type": "PREPAY",
"phone_required": false,
"license_required": false,
"cpf_required": false,
"f_id": 123456,
"printed_pass_required": false,
"currency": "$",
"processing_engine": "PARKME"
}
]
}
Reservation API
The Reservations API is used for ParkMe’s reservations platform. Query operators are passed to the API via the HTTP/1.1 GET, POST, and PUT requests.
/reservation/ |
All reservations |
/reservation/1721c490-2eba-11e2-9781-123140015e3a |
Single reservation |
RESERVATION AUTHENTICATION
Most of the endpoints require authentication either via a ParkMe session aka Cookie-based Session Validation or HTTP Basic Auth.
GET requests are used to get information about reservations given a search parameter. The application must pass username:password via the HTTP1.1 Authentication method. Requests will different depending on the privileges assigned to the user.
Create a Reservation
POST requests are used to create a reservation (or a quote). The application must pass username:password via the HTTP1.1 Authentication method.
SAMPLE REQUEST
curl -X POST --user name:password -d '&f_id=115539&entry_time=2018-05-06T12:26&duration=120&pk_reservation_product=921129fc-9f34-11e3-aa2b-22000afd0bd2&action=Reserve' https://parking-api.inrix.com/reservation/
/product
GET Get available reservations in a given lot from http://parking-api.inrix.com/product/.
Parameters
= requiredName | Located In | Type | Description |
---|---|---|---|
f_id | Query | String | Specific lot or f_id is required. |
lot | Query | String | Specific lot or f_id is required. |
entry_dt | Query | String | yyyy-mm-ddTHH:MM format, add a Z for UTC, otherwise treated locally |
duration | Query | Integer | Duration in minutes. Can be pipe delimited for multiple durations, eg: 60|120|720|1400 |
Responses
200 Available reservation products
/reservation
GET get all reservations
Responses
200 Get information on a reservation
POST create a new reservation
Parameters
= requiredName | Located In | Type | Description |
---|---|---|---|
Authorization | Header | String | The API Key following 'Bearer ' |
Accepts | Header | String | 'application/json' or 'application/xml' |
id | Body | Integer | A unique lot id |
pk_reservation_product | Body | String | The UUID of the reservation product |
action | Body | String | Reserve, Redeem, Scan or Cancel |
entry_time | Query | String | yyyy-mm-ddTHH:MM:ss |
duration | Query | Integer | Duration in minutes. Can be pipe delimited for multiple durations, eg: 60|120|720|1400 |
token | Body | String | Stripe token. If purchasing reservation, one form of financial info is needed. |
Responses
200 Successful creation of a reservation
/reservation/{reservationId}
GET get a specific reservation
Parameters
= requiredName | Located In | Type | Description |
---|---|---|---|
Authorization | Header | String | The API Key following 'Bearer ' |
Accepts | Header | String | 'application/json' or 'application/xml' |
reservationId | Path | String | The UUID of the specific reservation. |
Responses
200 Get information on a reservation
PUT update a specific reservation
Parameters
= requiredName | Located In | Type | Description |
---|---|---|---|
Authorization | Header | String | The API Key following 'Bearer ' |
Accepts | Header | String | 'application/json' or 'application/xml' |
reservationId | Path | String | The UUID of the specific reservation. |
action | Body | String | Either 'Cancel', 'Scan', or 'Redeem'. That is, cancel a reservation, scan a reservation (attendant at a gate station), or redeem a reservation, respectively. |