comtradekb logo
United Nations Commodity Trade Statistics Database |  Statistics Division

Comtrade KB Home : Access Points and Parameters for Web Services
Q10264 - INFO: Access Points and Parameters for Web Services

Access Points and Parameters for Web Services

Summary

UN Comtrade Web Services site is http://comtrade.un.org/ws. To construct a proper web service request, append web services site with access points and combine them with (query string) parameters. See example section below.

Table 1. UN Comtrade Web Services Access Points and its Parameters

 

Access Points \ Parameters

px

r

y

cc

p

rg

so

tv1

tv2

qt

lowT

highT

comp

isOri

max

app

count

async

Reference

refs/getCommodityList.aspx

X

X

X

 

refs/getCountryList.aspx

X

X

 

Metadata

refs/getDataAvailability.aspx

X

X

X

X

X

X

X

X

 

refs/getDATariffLine.aspx

 

X

X

X

X

X

X

 

refs/getExplanatoryNotes.aspx

 

X

X

X

X

X

X

 

refs/getPublicationNotes.aspx

 

X

X

X

X

X

X

 

Data

get.aspx1

X

x

X

X

X

X

X

X

X

X

X

get.aspx?detail=true2

X

X

X

X

X

X

X

X

X

getSdmxV1.aspx

X

X

X

X

X

X

X

 

gettTotal.aspx

X

X

X

X

 

getConvFactor.aspx

X

X

X

X

 

getSdmxTariffLineV1.aspx

X

X

X

X

X

X

X

 

getTariffLine.aspx

X

X

X

X

X

X

X

X

 

getDataMapServer.aspx3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1) all commodity wild cards work expect AG; no advanced filter
2) fully compatible with Basic/Express Selection
3) used for UN Comtrade only
Free access points highlighted in green, subscriber only access points in yellow, and restricted access points in red

Access Points

Access Points

Descriptions

refs/getCommodityList.aspx

Get list of commodity

refs/getCountryList.aspx

Get list of country

refs/getDataAvailability.aspx

Get data availability

refs/getDATariffLine.aspx

Get tariff line data availability

refs/getExplanatoryNotes.aspx

Get explanatory notes

refs/getPublicationNotes.aspx

Get publication notes

get.aspx

Get data in element-based XML format

get.aspx?detail=true

Get data in element-based XML format

getSdmxV1.aspx

Get data in SDMX version 1.0 format

gettTotal.aspx

Get Total Trade in XML format

getConvFactor.aspx

Get Conversion Factor in XML format

getSdmxTariffLineV1.aspx

Get Tariff line data in SDMX version 1.0 format

getTariffLine.aspx

Get Tariff line data in XML format

getDataMapServer.aspx

Get data in GML format

 


 

Parameters

Parameters

Descriptions

Possible Values

px

Commodity Classifications

HS, H0-H3, ST, S1-S4, BE

r

Reporting Countries

UN Comtrade Country Codes or Country Groups

y

Years

4 digits year

cc

Commodity Codes

Commodity Codes, with wild cards or Commodity Groups

p

Partner Countries

UN Comtrade Country Codes or Country Groups

rg

Trade Flow

Number 1 to 4

so

Sort Order

See below

tv1

Comparison Sign

See below

tv2

Comparison Value

See below

qt

Aggregation Option

y or n

lowT

Start Date / Time

 Date format YYYY-MM-DD

highT

End Date / Time

 Date format YYYY-MM-DD

comp

Data Compression

true or false

isOri

Reported/Converted Data

true or false

max

Max returned records

Number

app

Application Identifier

Any text (optional)

count

To count no of records

true or false

async

Asynchronous Web Call

true or false; see related KB articles

Additional information:

so= pre-defined sort order ; possible values
"1" Year;Flow;Rep;Comm;Ptnr;
"2" Year;Rep;Flow;Comm;Ptnr;
"3" Flow;Year;Rep;Comm;Ptnr;
"4" Flow;Rep;Year;Comm;Ptnr;
"5" Rep ;Year;Flow;Comm;Ptnr;
"6" Rep ;Flow;Year;Comm;Ptnr;
"7" Comm;Year;Flow;Rep ;Ptnr;
"8" Comm;Year;Rep ;Flow;Ptnr;
"9" Comm;Flow;Year;Rep ;Ptnr;
"10" Comm;Flow;Rep ;Year;Ptnr
"11" Comm;Rep ;Year;Flow;Ptnr;
"12" Comm;Rep ;Flow;Year;Ptnr;
"13" Year;Flow;Rep;Comm;TradeVal;
"14" Year;Rep;Flow;Comm;TradeVal;
"15" Flow;Year;Rep;Comm;TradeVal;
"16" Flow;Rep;Year;Comm;TradeVal;
"17" Rep ;Year;Flow;Comm;TradeVal;
"18" Rep ;Flow;Year;Comm;TradeVal;
"19" Comm;Year;Flow;Rep ;TradeVal;
"20" Comm;Year;Rep ;Flow;TradeVal;
"21" Comm;Flow;Year;Rep ;TradeVal;
"22" Comm;Flow;Rep ;Year;TradeVal
"23" Comm;Rep ;Year;Flow;TradeVal;
"24" Comm;Rep ;Flow;Year;TradeVal;
"1001" TradeVal;
"9999" --None--

For an example, so=13 will order the result by year, flow, reporter, commodity and value

Filter Trade value, use tv1 and tv2
tv1=comparison sign:
0"Greater Than Equal
1"Greater Than
2"Less Than Equal
3"Less Than
tv2= comparison value in US$

For an example, tv1=0&tv2=1000000000 will filter the result for trade value >= 1 billion US$

Aggregation option
qt=n or qt=y. If qt set to n, the system will keep the quantity differences during the on-fly commodity aggregation.

Example

The easiest to learn the query string is to copy query string from UN Comtrade web site during the data selection (http://comtrade.un.org/db/dqQuickQuery.aspx), Then just add them to web access points (don’t forget to add comp=false)

 Top 10 exported commodities (6digit) from China to the World that have values more than $500 Millions Dollars.

 http://comtrade.un.org/ws/get.aspx?cc=??????&px=H2&r=156&y=2007&p=0&rg=2&tv1=0&tv2=500000000&so=1001&qt=n&detail=true&comp=false&max=10

Get original loaded data sets after 15 June 2006 17:44:01

http://comtrade.un.org/ws/refs/getDataAvailability.aspx?lowT=2006-06-15T17:44:01&isOri=true

Get data in total trade of Ireland 2006 data in SDMX format

http://comtrade.un.org/ws/getSdmxV1.aspx?cc=TOTAL&px=H2&r=372&y=2006&comp=false

Related KB Articles

-          Data Extraction using Comtrade Web Service

-          ComtradeTools

-          Asynchronous Web Service

 

Related Articles
No Related Articles Available.

Article Attachments
Access Points and Parameters for Web Services.pdf

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 2009-03-12.
Last Modified on 2009-03-12.
Last Modified by Markie.Muryawan.
Article has been viewed 1496 times.
Rated 0 out of 10 based on 0 votes.
Print Article
Email Article