Top 10 HS Code YoY
Retrieve year-over-year metrics for the top 10 HS codes, sorted by value or quantity.
ENDPOINTS
POST /api/v1/tradeAnalytics/top10HsYoy
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:
Yes - Example:
2
type
int
HS code depth level
- Required:
Yes - Example:
6
Request Example
{
"countryCode": "USA",
"ie": "i",
"hsCode": "28",
"sortType": 2,
"type": 6
}
curl https://api.tradedata.io/api/v1/tradeAnalytics/top10HsYoy \
-H "Authorization: Bearer yourTokenHere" \
-H "Content-Type: application/json" \
-d '{"countryCode": "USA", "ie": "i", "hsCode": "28", "sortType": 2, "type": 6}'
import requests
response = requests.post(
"https://api.tradedata.io/api/v1/tradeAnalytics/top10HsYoy",
headers={
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
json={
"countryCode": "USA",
"ie": "i",
"hsCode": "28",
"sortType": 2,
"type": 6,
},
)
print(response.json())
const response = await fetch("https://api.tradedata.io/api/v1/tradeAnalytics/top10HsYoy", {
method: "POST",
headers: {
"Authorization": "Bearer yourTokenHere",
"Content-Type": "application/json",
},
body: JSON.stringify({
"countryCode": "USA",
"ie": "i",
"hsCode": "28",
"sortType": 2,
"type": 6
}),
});
const data = await response.json();
<?php
$ch = curl_init("https://api.tradedata.io/api/v1/tradeAnalytics/top10HsYoy");
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,
"type" => 6
]),
]);
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:
45.44
data.stat.preValue
number
Previous-period trade value
- Example:
12353874
data.stat.value
number
Trade value
- Example:
17966963
data.stat.valueChange
number
Trade value change
- Example:
5613089
data.stat.qtyYoy
number
Year-over-year change of quantity
- Example:
29.66
data.stat.preQty
number
Previous-period quantity
- Example:
1896910
data.stat.qty
number
Quantity
- Example:
2459583
data.stat.qtyChange
number
Quantity change
- Example:
562673
data.stat.hsCode
string
HS code
- Example:
0208
data.year
int
Current year
- Example:
2022
data.preYear
int
Previous year
- Example:
2021
Response Example
{
"code": 200,
"success": true,
"data": {
"stat": [
{
"valueYoy": 45.44,
"preValue": 12353874,
"value": 17966963,
"valueChange": 5613089,
"qtyYoy": 29.66,
"preQty": 1896910,
"qty": 2459583,
"qtyChange": 562673,
"hsCode": "0208"
}
],
"year": 2022,
"preYear": 2021
},
"msg": "success",
"total": 0,
"pageSize": 0,
"current": 0,
"sumResult": null
}