Sales Prices (sales_prices)
Returns the original and sales prices of each product. No extra parameters besides the common ones. Sales/admin only.
API info
| Item | Value |
|---|---|
| Endpoint | POST /api.php |
| action | sales_prices |
| Authentication | Global APP ID / APP KEY |
| Role restriction | Sales / admin only |
Request parameters
No extra parameters besides the common ones (action / app_id / app_key).
Request example
{
"action": "sales_prices",
"app_id": "68B0FA47FEC9E7EBC4BF80F8",
"app_key": "2b901515a427b6c0b68f866eece70e0d2ecf687146022412"
}
PHP
<?php
$app_id = '68B0FA47FEC9E7EBC4BF80F8';
$app_key = '2b901515a427b6c0b68f866eece70e0d2ecf687146022412';
$url = 'https://yunsapi.com/api.php';
$params = [
'action' => 'prices',
'app_id' => $app_id,
'app_key' => $app_key,
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($ch);
curl_close($ch);
echo $resp;
Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class ApiDemo {
static final String URL = "https://yunsapi.com/api.php";
static final String APP_ID = "68B0FA47FEC9E7EBC4BF80F8";
static final String APP_KEY = "2b901515a427b6c0b68f866eece70e0d2ecf687146022412";
public static void main(String[] args) throws Exception {
String body = "{\"action\":\"prices\",\"app_id\":\"" + APP_ID + "\",\"app_key\":\"" + APP_KEY + "\"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create(URL))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());
}
}
Response example
{
"code": 0,
"msg": "success",
"data": [
{
"api_id": "1",
"name": "SMS Verification",
"code": "dxyzm",
"is_buyout": "0",
"original_price": "0.0000",
"buyout_price": null,
"unit_price": "0.0520"
}
]
}
Response parameters
| Parameter | Type | Description |
|---|---|---|
data[].api_id | string | API ID |
data[].name | string | API name |
data[].code | string | API code |
data[].is_buyout | string | Whether buyout |
data[].original_price | string | Original price |
data[].buyout_price | string | Buyout sales price (buyout) |
data[].unit_price | string | Per-call sales price (package) |