To request post data, use this code:
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"key": "YOUR_API_KEY",
"action": "status",
"orders": "ORDER_ID_1,ORDER_ID_2,ORDER_ID_3"
}' \
https://onpanel.ir/api/v2
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://onpanel.ir/api/v2")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path, {'Content-Type' => 'application/json'})
request.body = {
"key" => "YOUR_API_KEY",
"action" => "status",
"orders" => "ORDER_ID_1,ORDER_ID_2,ORDER_ID_3"
}.to_json
response = http.request(request)
puts JSON.parse(response.body)
import requests
url = "https://onpanel.ir/api/v2"
payload = {
"key": "YOUR_API_KEY",
"action": "status",
"orders": "ORDER_ID_1,ORDER_ID_2,ORDER_ID_3"
}
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
$url = "https://onpanel.ir/api/v2";
$data = array(
"key" => "YOUR_API_KEY",
"action" => "status",
"orders" => "ORDER_ID_1,ORDER_ID_2,ORDER_ID_3"
);
$options = array(
'http' => array(
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
echo "Error";
} else {
echo $result;
}
const axios = require('axios');
const url = 'https://onpanel.ir/api/v2';
const data = {
key: 'YOUR_API_KEY',
action: 'status',
orders: 'ORDER_ID_1,ORDER_ID_2,ORDER_ID_3',
};
axios.post(url, data, {
headers: {
'Content-Type': 'application/json',
},
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
The above command returns JSON structured like this:
Success:
{
"1": {
"charge": "0.27819000",
"start_count": "3572",
"status": "Partial",
"remains": "157",
"currency": "Toman"
},
"2": {
"charge": "0E-8",
"start_count": "0",
"status": "Pending",
"remains": "0",
"currency": "Toman"
},
"33": {
"error": "Incorrect order ID"
}
}
Error:
{
"33": {
"error": "Incorrect order ID"
}
}