TSB logo

Access Points and Parameters for Web...

Expand / Collapse
 

Access Points and Parameters for Web...


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 the web services site with access points and combine them with (query string) parameters.  See example section below.

Table: UN Comtrade Web Services Access Points and its Parameters



1) All commodity wild cards work except AG; no advance 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-H4, 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

code

Authorization Code

Use for off-site web services access.  Can be obtained from http://comtrade.un.org/db/u/uAccountInfo.aspx

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 the same dataset using Authorization Code

 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&code=YourCode

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



Rate this Article:

Related Links



Add Your Comments


Name: *
Email Address:
Web Address:
   
  
 
 
   
Verification Code:
*
 

Details
Last Modified:Wednesday, February 19, 2014
Last Modified By: comtrade_admin
Type: HOWTO
Rated 5 stars based on 1 vote
Article has been viewed 12,687 times.
Options