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/{id}
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.
- The request path must include product id.
Parameter | Type | Mandatory | Description |
---|---|---|---|
type | string | yes | Pricing type. Possible values: DYNAMIC_PRICING |
valid_from | datetime (ISO 8601) | no | Time when this pricing becomes valid. 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 for REGULAR . Required for DYNAMIC if 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 only for REGULAR 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 FROM_DURATION and UNTIL_DURATION restriction types |
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 daily price 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 24 hour period, the price can never exceed 400.
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
Possible error id-s
Error id | Explanation |
---|---|
forbidden | Unauthorized |
internal_server_error | Internal server error |
missing_property | A required property in request is missing |
message_not_readable | A problem with the request body |
server_communication_error | Error communication with server |
invalid_accumulative_24h_max_price | Only 'amount' should be sent with type ACCUMULATIVE_24H_MAX |
invalid_regular_price | Only 'amount' and 'period' should be sent with type REGULAR |
invalid_dynamic_price | 'amount', 'period' and 'hourly_amounts' should be sent with type DYNAMIC prices. 'restrictions' is optional. |
invalid_weekdays | Invalid values for weekdays. Allowed values: [MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY] |
invalid_hours | Invalid values for hours. Allowed values 0-23 |
invalid_period | Invalid period. Should be a number, followed by a space, followed by [SECOND(S)|MINUTE(S)|HOUR(S)|DAY(S)] |
invalid_restriction | Invalid restriction type. Allowed values: [WEEKDAYS, FROM_DURATION, UNTIL_DURATION] |