Top 10 Trade Partner YoY
Retrieve year-over-year metrics for the top 10 trade partners, sorted by value or quantity.
ENDPOINTS
POST /api/v1/tradeAnalytics/top10PartnerYoy
Request parameters
countryCode
string
Country ISO3 code
- Required:
Yes - Example:
USA
ie
string
Trade flow. Use i for import and e for export.
- Required:
No - Example:
i
hsCode
string
HS code
- Required:
No - Example:
28
sortType
int
Sort type. 1 sorts by value; 2 sorts by quantity.
- Required:
No - Example:
2
Request Example
{
"countryCode": "USA",
"ie": "i",
"hsCode": "28",
"sortType": 2
}
curl https://api.tradedata.io/api/v1/tradeAnalytics/top10PartnerYoy \
-H "Authorization: Bearer yourTokenHere" \
-H "Content-Type: application/json" \
-d '{"countryCode": "USA", "ie": "i", "hsCode": "28", "sortType": 2}'
import requests
response = requests.post(
"https://api.tradedata.io/api/v1/tradeAnalytics/top10PartnerYoy",
headers={
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
json={
"countryCode": "USA",
"ie": "i",
"hsCode": "28",
"sortType": 2,
},
)
print(response.json())
const response = await fetch("https://api.tradedata.io/api/v1/tradeAnalytics/top10PartnerYoy", {
method: "POST",
headers: {
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
body: JSON.stringify({
"countryCode": "USA",
"ie": "i",
"hsCode": "28",
"sortType": 2
}),
});
const data = await response.json();
<?php
$ch = curl_init("https://api.tradedata.io/api/v1/tradeAnalytics/top10PartnerYoy");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer yourTokenHere",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"countryCode" => "USA",
"ie" => "i",
"hsCode" => "28",
"sortType" => 2
]),
]);
echo curl_exec($ch);
Response parameters
code
int
Status code
- Example:
200
data
object
Result container
data.stat
array
Statistics list
- Example:
-
data.stat.valueYoy
number
Year-over-year change of trade value
- Example:
643.12
data.stat.preValue
number
Previous-period trade value
- Example:
80251
data.stat.value
number
Trade value
- Example:
596362
data.stat.valueChange
number
Trade value change
- Example:
516111
data.stat.qtyYoy
number
Year-over-year change of quantity
- Example:
675
data.stat.preQty
number
Previous-period quantity
- Example:
10128
data.stat.qty
number
Quantity
- Example:
78492
data.stat.qtyChange
number
Quantity change
- Example:
68364
data.stat.partnerCode
string
Partner country numeric code
- Example:
352
data.stat.countryName
string
Partner country name
- Example:
Iceland
data.stat.iso3
string
Partner country ISO3 code
- Example:
ISL
data.year
int
Current year
- Example:
2022
data.preYear
int
Previous year
- Example:
2021
Response Example
{
"code": 200,
"success": true,
"data": {
"stat": [
{
"valueYoy": 643.12,
"preValue": 80251,
"value": 596362,
"valueChange": 516111,
"qtyYoy": 675,
"preQty": 10128,
"qty": 78492,
"qtyChange": 68364,
"partnerCode": "352",
"countryName": "Iceland",
"iso3": "ISL"
}
],
"year": 2022,
"preYear": 2021
},
"msg": "success",
"total": 0,
"pageSize": 0,
"current": 0,
"sumResult": null
}