Available resources
Access requirements
- A valid authentication token is required to access the API. How to authenticate your application
PUT - Update pricing
This method allows you to send a new price schema for a specified product
Endpoint
PUT https://api.autopay.io/price/v1/product/{productId}
Request parameters
- The request body must be in JSON format and HTTP headers must include
Content-Type: application/json
. - The headers must include a valid access token.
Parameter | Type | Mandatory | Description |
---|---|---|---|
product_id | number | yes | ID of the product. NOTE: this should not be included in the payload, but as a path variable |
type | string | yes | Pricing type. Possible values: DYNAMIC_PRICING |
valid_from | date-time | no | Time when this pricing becomes valid (ISO8601). Will become valid instantly when null |
prices | List of prices | yes | |
type | string | yes | Type of price. Multiple DYNAMIC and REGULAR prices can be used. Possible values:
|
period | string | no | Period for price (e.g. "30 MINUTES", "1 HOUR"). Required if DYNAMIC price does not cover all 24 hours and all non-zero REGULAR prices. Supported periods: SECOND(S),MINUTE(S),HOUR(S),DAY(S) |
amount | decimal | yes | Price for a period. |
hourly_amounts | Map<number, decimal> | no | A map where the key is the hour (0-23) and the value is the price for that hour. Only for DYNAMIC price type |
restrictions | List of restrictions | no | Optional, can be used on both DYNAMIC and REGULAR prices. Multiple restrictions can be used for one price. |
type | string | yes | Restriction type. Possible values:
|
restrict_to | List of strings | yes | List of weekdays. ex ["MONDAY", "TUESDAY", "..."] for WEEKDAYS type, period (ex. "30 MINUTES", "1 HOUR") for duration based restrictions |
Example request
This example includes:
- Dynamic price that is valid from Monday to Friday. A different minute price is valid each hour from 9 to 17. The rest of the day has a minute price of 1.0
- A regular price that defines the daily price. This will be used on days when dynamic price is not valid (weekends) or when the sum of hourly prices would be more expensive.
- A regular price that makes weekends free if the service (e.g. parking) is longer than 7 days.
- An accumulative daily price. If the car uses the service multiple times in a 24hour period, the price can never exceed 400.
{
"type": "DYNAMIC_PRICING",
"valid_from": "2021-02-28T11:52:16+0000",
"prices": [
{
"type": "DYNAMIC",
"restrictions": [
{
"type":"WEEKDAYS",
"restrict_to": [
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY"
]
}
],
"amount": 1.0,
"period": "1 MINUTE",
"hourly_amounts": {
"9": 2.1,
"10": 2.1,
"11": 2.6,
"12": 2.9,
"13": 3.1,
"14": 4.5,
"15": 2.1,
"16": 2.0
}
},
{
"type": "REGULAR",
"amount": 300.0,
"period": "24 HOURS"
},
{
"type": "REGULAR",
"amount": 0,
"restrictions": [
{
"type":"WEEKDAYS",
"restrict_to": [
"SATURDAY",
"SUNDAY"
]
},
{
"type":"FROM_DURATION",
"restrict_to": "7 DAYS"
}
]
},
{
"type": "ACCUMULATIVE_24H_MAX",
"amount": 400.0
}
]
}
Success response
HTTP Code: 204 OK
Example request
PUT https://api.autopay.io/price/v1/product/123456
Error messages
Parameter | Type | Description |
---|---|---|
error_id | string | Specific code of error. See below for possible values |
message | string | Description of error |
description | string | Optional value. Additional description of error. |
Example error response
{
"error_id": "authentication_error",
"message": "No access token present in header!"
}
Possible error id-s
Error id | Explanation |
---|---|
forbidden | Unauthorized |
internal_server_error | Internal server error |