Add service to order
GET /api/rent.php?method=add_service_to_order
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.
This request can modify a rental or incur charges. If the response is lost, check your orders and history before trying again: the change may already have been made. The examples do not retry automatically.
Authentication
Send apikey as a required query parameter.
Parameters
| Name | Location | Type | Required | Example | Description |
|---|---|---|---|---|---|
method | query | string | Yes | "add_service_to_order" | 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 | 56547 | ID of order |
service | query | string | Yes | "opt89" | Service code Services list |
pnumber | query | string | Yes | "79335445295" | rented phone number with country code without plus sign |
rent_days | query | integer | No | 7 | Optional parameter. Number of days to rent the service. If not specified, default duration will be used (7 days for most countries, 1 day for Canada). |
How to use this method
Add a service to an existing rental. Find its ID and pnumber in Rental orders, then check the new service and its price in Data by provider for that country.
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_RENTAL_NUMBER:pnumber.
: "${SMSPVA_API_KEY:?Set SMSPVA_API_KEY}"
: "${SMSPVA_RENTAL_ORDER_ID:?Set SMSPVA_RENTAL_ORDER_ID}"
: "${SMSPVA_RENTAL_NUMBER:?Set SMSPVA_RENTAL_NUMBER}"
curl --get --fail-with-body --max-time 30 "https://smspva.com/api/rent.php" \
--data-urlencode "method=add_service_to_order" \
--data-urlencode "apikey=$SMSPVA_API_KEY" \
--data-urlencode "id=$SMSPVA_RENTAL_ORDER_ID" \
--data-urlencode "service=opt89" \
--data-urlencode "pnumber=$SMSPVA_RENTAL_NUMBER" \
--data-urlencode "rent_days=7"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": {
"id": 4211321,
"pnumber": "37067181111",
"service": "opt95",
"until": 1771583220
}
}| Name | Type | Description |
|---|---|---|
status | integer | Status of the response: 1 for success, 0 for failure |
data | object | Service addition details |
data.id | integer | Order ID |
data.pnumber | string | Phone number |
data.service | string | Service code Services list |
data.until | integer | Service expiration time (UNIX timestamp) |