Rental history
GET /api/rent.php?method=get_rent_history
Send a GET request and check status in the JSON response: 1 means success and 0 means failure, even with HTTP 200. If it fails, read msg for the reason.
Authentication
Send apikey as a required query parameter.
Parameters
| Name | Location | Type | Required | Example | Description |
|---|---|---|---|---|---|
method | query | string | Yes | "get_rent_history" | Method name |
apikey | query | string | Yes | SMSPVA_API_KEY | Your API key You can find it on the website in the top right drop-down menu in the Profile and APIKEY section |
skip | query | integer | No | 0 | Number of items to skip |
take | query | integer | No | 10 | Number of items received |
How to use this method
Find completed rentals and check isAvailForRestore to see which can be restored. For an eligible order, check cost and duration before restoring it.
Request examples
Environment and dependencies. Each example encodes query values and allows 30 seconds for the request. Check HTTP and JSON status before using data. cURL prints the response for you to check; Java uses Jackson to read the JSON.
: "${SMSPVA_API_KEY:?Set SMSPVA_API_KEY}"
curl --get --fail-with-body --max-time 30 "https://smspva.com/api/rent.php" \
--data-urlencode "method=get_rent_history" \
--data-urlencode "apikey=$SMSPVA_API_KEY" \
--data-urlencode "skip=0" \
--data-urlencode "take=10"Responses
Check the response that matches your request. Example values and dates are illustrative. Optional fields can depend on the outcome or the response format you selected.
HTTP 200
Success
application/json
Illustrative response
{
"status": 1,
"data": [
{
"orderId": 857191,
"resourceCode": "opt9",
"number": "37067787324",
"branchId": 684,
"haveSms": false,
"isAvailForRestore": true,
"days": 30,
"country": "LT",
"begin": 1768902473,
"end": 1771494473,
"closed": 1768903921
}
]
}| Name | Type | Description |
|---|---|---|
status | integer | Status of the response: 1 for success, 0 for failure |
data | array<object> | |
data[].orderId | integer | ID of order |
data[].resourceCode | string | Service code Services list |
data[].number | string | rented phone number with country code without plus sign |
data[].branchId | integer | Internal branch ID for the order |
data[].haveSms | boolean | Whether SMS was received on this number during the rental |
data[].isAvailForRestore | boolean | Whether this order can be restored (renewed). If true, you can use the Restore method to renew this rental with a new number. |
data[].days | integer | Number of days the order was rented for |
data[].country | string | Country code of number Countries list |
data[].begin | integer | UNIX timestamp of start date |
data[].end | integer | UNIX timestamp of end date |
data[].closed | integer | UNIX timestamp of closed date |