Restore precalculation
GET /api/rent.php?method=restore_user_precalc
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 | "restore_user_precalc" | 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 |
id | query | integer | Yes | "" | ID of order |
How to use this method
Check the cost, duration and availability of restoring an expired rental. Get its ID from Rental history, where isAvailForRestore must be true. This calculation is the first step; call Restore rental to complete the restoration.
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_RENTAL_ORDER_ID: id.
: "${SMSPVA_API_KEY:?Set SMSPVA_API_KEY}"
: "${SMSPVA_RENTAL_ORDER_ID:?Set SMSPVA_RENTAL_ORDER_ID}"
curl --get --fail-with-body --max-time 30 "https://smspva.com/api/rent.php" \
--data-urlencode "method=restore_user_precalc" \
--data-urlencode "apikey=$SMSPVA_API_KEY" \
--data-urlencode "id=$SMSPVA_RENTAL_ORDER_ID"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": {
"ccode": "LT",
"scode": "opt9",
"price": 1.5,
"sname": "Instagram",
"pnumber": "37067787324",
"outdays": 5,
"orderid": 857191,
"prolongTo": 30
}
}| Name | Type | Description |
|---|---|---|
status | integer | Status of the response: 1 for success, 0 for failure |
data | object | |
data.ccode | string | Country code of number Countries list |
data.scode | string | Service code Services list |
data.price | number | Cost to restore this order |
data.sname | string | Service name |
data.pnumber | string | rented phone number with country code without plus sign |
data.outdays | integer | Number of days since the order expired |
data.orderid | integer | ID of order |
data.prolongTo | integer | Number of days for which the restored order will be active |
msg | string | Error message when status is 0. |