Using SDMX 2.1 Web Service

The Data Service can be used either as ASP.NET Web Service or as WCF Service. They are distinguished by the URL.

To add reference to ASP.NET Web Service, use the following URL: http://dataservices.imf.org/sdmx21/SDMX_Web_Service21.asmx.

To add reference to WCF Service into your project, use the following URL: http://dataservices.imf.org/sdmx21/SDMX_WCF_Service21.svc.

These URLs are given as examples and may be different on the concrete server.

The SDMX Web Service exposes the following methods:

  • GetDataflow
  • GetDataStructure
  • GetStructureSpecificTimeSeriesData
  • GetMetadataStructure
  • GetGenericMetadata
  • GetCodeList
  • GetMaxSeriesInResult

1.1 GetDataflow Method

GetDataflow method returns the list of the datasets, registered for the Data Service.

C# SYNTAX

public StructureType GetDataflow(DataflowQueryType DataflowQuery);

PARAMETERS

 
DataflowQuery
Type: DataflowQueryType
SDMX-ML structure message.  

RETURN VALUE

Type: StructureType
SDMX-ML structure message.

REMARKS

SDMX-ML structure message is returned if no databases registered for the SDMX Web Service and no exceptions are thrown.

EXAMPLES

The following code example shows the use of GetDataflow method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); var result = client.GetDataflow(new ASMX21.DataflowQueryType());

WCF Service example:
WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient();
var result = client.GetDataflow(new WCF21.DataflowQueryType());

1.2 GetDataStructure Method

GetDataStructure method returns the structure of the dataset in the SDMX-ML structure message for the given SDMX-ML query message.

C# SYNTAX

StructureType GetDataStructure(DataStructureQueryType DataStructureQuery);

PARAMETERS

DataStructureQuery

       Type: DataStructureQueryType

 SDMX-ML query message

RETURN VALUE

Type: StructureType

SDMX-ML structure message.

EXAMPLES

 The following code example creates simple SDMX data structure query and shows the use of GetDataStructure method.

 ASP.NET Web Service example:   

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); var query = new ASMX21.DataStructureQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""> <DataStructureWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""> <ID>FAS</ID> </DataStructureWhere> </Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetDataStructure(query);

  WCF Service example:  
WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient();
var query = new WCF21.DataStructureQueryType();
XmlDocument doc = new XmlDocument();
doc.LoadXml(@"
<Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message"">
    <DataStructureWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query"">
        <ID>FAS</ID>
    </DataStructureWhere>
</Query>");
query.Any = new XmlElement[1]
     {
             doc.DocumentElement
     };
var result = client.GetDataStructure(query);

1.3 GetStructureSpecificTimeSeriesData Method


GetStructureSpecificTimeSeriesData method returns the SDMX-ML compact data message for the given SDMX-ML query message.

C# SYNTAX


StructureSpecificTimeSeriesDataType GetStructureSpecificTimeSeriesData(StructureSpecificTimeSeriesDataQueryType StructureSpecificTimeSeriesDataQuery)

PARAMETERS

StructureSpecificTimeSeriesDataQuery
 Type: StructureSpecificTimeSeriesDataQueryType
SDMX-ML query message

RETURN VALUE

Type: StructureSpecificTimeSeriesDataType
SDMX-ML compact data message.

EXAMPLES

The following code example creates simple SDMX data query and shows the use of GetStructureSpecificTimeSeriesData method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); var query = new ASMX21.StructureSpecificTimeSeriesDataQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <mes:Query xmlns:qry=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query"" xmlns:mes=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message"" xsi:type=""qry:GenericTimeSeriesDataQueryType"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""> <qry:DataWhere> <qry:Or> <qry:And> <qry:DataSetID>FAS</qry:DataSetID> <qry:Or> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>FR</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>HR</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>AL</qry:Value> </qry:DimensionValue> </qry:Or> <qry:Or> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCLODC_XDC</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCBODD_NUM</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCLODCHG_GDP_PT</qry:Value> </qry:DimensionValue> </qry:Or> <qry:TimeDimensionValue> <qry:ID>TIME_PERIOD</qry:ID> <qry:TimeValue operator=""greaterThanOrEqual"">2000</qry:TimeValue> <qry:TimeValue operator=""lessThanOrEqual"">2012</qry:TimeValue> </qry:TimeDimensionValue> </qry:And> </qry:Or> </qry:DataWhere> </mes:Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetStructureSpecificTimeSeriesData(query);

WCF Service example:

WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient(); var query = new WCF21.StructureSpecificTimeSeriesDataQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <mes:Query xmlns:qry=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query"" xmlns:mes=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message"" xsi:type=""qry:GenericTimeSeriesDataQueryType"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""> <qry:DataWhere> <qry:Or> <qry:And> <qry:DataSetID>FAS</qry:DataSetID> <qry:Or> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>FR</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>HR</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>AL</qry:Value> </qry:DimensionValue> </qry:Or> <qry:Or> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCLODC_XDC</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCBODD_NUM</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCLODCHG_GDP_PT</qry:Value> </qry:DimensionValue> </qry:Or> <qry:TimeDimensionValue> <qry:ID>TIME_PERIOD</qry:ID> <qry:TimeValue operator=""greaterThanOrEqual"">2000</qry:TimeValue> <qry:TimeValue operator=""lessThanOrEqual"">2012</qry:TimeValue> </qry:TimeDimensionValue> </qry:And> </qry:Or> </qry:DataWhere> </mes:Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetStructureSpecificTimeSeriesData(query);

1.4 GetMetadataStructure Method

GetMetadataStructure method returns the metadata structure of the dataset in the SDMX-ML structure message for the given SDMX-ML query message.

C# SYNTAX

StructureType GetMetadataStructure(MetadataStructureQueryType MetadataStructureQuery)

PARAMETERS

MetadataStructureQuery
        Type:StructureType
        SDMX-ML query message

RETURN VALUE

Type: StructureType
SDMX-ML metadata structure message.

EXAMPLES

The following code example creates simple SDMX metadata structure query and shows the use of GetMetadataStructure method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); ASMX21.MetadataStructureQueryType query = new ASMX21.MetadataStructureQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""> <MetadataStructureWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""> <ID>FAS</ID> </MetadataStructureWhere> </Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetMetadataStructure(query);

WCF Service example:

WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient(); WCF21.MetadataStructureQueryType query = new WCF21.MetadataStructureQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""> <MetadataStructureWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""> <ID>FAS</ID> </MetadataStructureWhere> </Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetMetadataStructure(query);

1.5 GetGenericMetadata Method

GetGenericMetadata method returns the SDMX-ML generic data message for the given SDMX-ML query message.

C# SYNTAX

GenericMetadataType GetGenericMetadata(MetadataQueryType GenericMetadataQuery)

PARAMETERS

GenericMetadataQuery
       Type: MetadataQueryType
       SDMX-ML query message

RETURN VALUE

Type: GenericMetadataType
SDMX-ML generic data message.

EXAMPLES

The following code example creates simple SDMX data query and shows the use of GetGenericMetadata method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); var query = new ASMX21.MetadataQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <mes:Query xmlns:qry=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query"" xmlns=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:mes=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message"" xmlns:com=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common""> <qry:MetadataParameters> <qry:MetadataTargetValue> <qry:TargetObjectValue> <qry:DataSet> <com:ID>FAS</com:ID> </qry:DataSet> </qry:TargetObjectValue> </qry:MetadataTargetValue> <qry:Or> <qry:ReportStructureValue> <qry:MetadataAttributeValue> <qry:ID>INDICATOR</qry:ID> <qry:TextValue>All Indicators</qry:TextValue> </qry:MetadataAttributeValue> <qry:MetadataAttributeValue> <qry:ID>REF_AREA</qry:ID> <qry:TextValue>AR</qry:TextValue> </qry:MetadataAttributeValue> <qry:MetadataAttributeValue> <qry:ID>INDICATOR</qry:ID> <qry:TextValue>FCLODCSG_GDP_PT</qry:TextValue> </qry:MetadataAttributeValue> <qry:MetadataAttributeValue> <qry:ID>REF_AREA</qry:ID> <qry:TextValue>BE</qry:TextValue> </qry:MetadataAttributeValue> <qry:MetadataAttributeValue> <qry:ID>REF_AREA</qry:ID> <qry:TextValue>CN</qry:TextValue> </qry:MetadataAttributeValue> </qry:ReportStructureValue> </qry:Or> </qry:MetadataParameters> </mes:Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetGenericMetadata(query);

WCF Service example:

WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient();
var query = new WCF21.MetadataQueryType();
XmlDocument doc = new XmlDocument();
doc.LoadXml(@"
<mes:Query
xmlns:qry=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""
xmlns=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:mes=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""
xmlns:com=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common"">
<qry:MetadataParameters>
<qry:MetadataTargetValue>
<qry:TargetObjectValue>
<qry:DataSet>
<com:ID>FAS</com:ID>
</qry:DataSet>
</qry:TargetObjectValue>
</qry:MetadataTargetValue>
<qry:Or>
<qry:ReportStructureValue>
<qry:MetadataAttributeValue>
<qry:ID>INDICATOR</qry:ID>
<qry:TextValue>All Indicators</qry:TextValue>
</qry:MetadataAttributeValue>
<qry:MetadataAttributeValue>
<qry:ID>REF_AREA</qry:ID>
<qry:TextValue>AR</qry:TextValue>
</qry:MetadataAttributeValue>
<qry:MetadataAttributeValue>
<qry:ID>INDICATOR</qry:ID>
<qry:TextValue>FCLODCSG_GDP_PT</qry:TextValue>
</qry:MetadataAttributeValue>
<qry:MetadataAttributeValue>
<qry:ID>REF_AREA</qry:ID>
<qry:TextValue>BE</qry:TextValue>
</qry:MetadataAttributeValue>
<qry:MetadataAttributeValue>
<qry:ID>REF_AREA</qry:ID>
<qry:TextValue>CN</qry:TextValue>
</qry:MetadataAttributeValue>
</qry:ReportStructureValue>
</qry:Or>
</qry:MetadataParameters>
</mes:Query>");
query.Any = new XmlElement[1]
{
doc.DocumentElement
};

var result = client.GetGenericMetadata(query);

1.6 GetCodeList Method

GetCodeList method returns the description of CodeLists

C# SYNTAX

StructureType GetCodelist(CodelistQueryType CodelistQuery)

PARAMETERS

CodelistQuery
Type: CodelistQueryType
SDMX-ML query message

RETURN VALUE

Type: StructureType
SDMX-ML codelist message.

EXAMPLES

The following code example creates simple SDMX data query and shows the use of GetCodeList method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); var query = new ASMX21.CodelistQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""> <CodelistWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""> <CodeWhere> <ID>CL_INDICATOR_FAS</ID> </CodeWhere> </CodelistWhere> </Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetCodelist(query);

WCF Service example:

WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient(); var query = new WCF21.CodelistQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""> <CodelistWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""> <CodeWhere> <ID>CL_INDICATOR_FAS</ID> </CodeWhere> </CodelistWhere> </Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetCodelist(query);

1.7 GetMaxSeriesInResult Method

GetMaxSeriesInResult method returns the maximum number of time series that can be returned by GetCompactData method.

C# SYNTAX

public int GetMaxSeriesInResult();

RETURN VALUE

Type: System.Int32

A non-negative integer value that represents the maximum number of time series that can be returned by GetCompactData method.

A special value of 0 means GetCompactData method can return unlimited number of time series.

EXAMPLES

The following code example shows the use of GetMaxSeriesInResult method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient();
var result =
client.GetMaxSeriesInResult();

 WCF Service example: 

WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient();
var result = client.GetMaxSeriesInResult();

Help Documents and References

  1. Query: How to use it
  2. Search: How to use it?
  3. Query: How to delete a saved query?
  4. Export Data: How to Bulk Download
  5. Navigation: How to find a dataset from the Home page
  6. Query: How to find the indicator for which I want data?
  7. Query: How to select multiple indicators
  8. Query: How to select the countries for which I want data?
  9. Query: How to select time and frequencies for which I want data?
  10. Query: How to change the font and font size?
  11. Query: How to change the number of decimal places?
  12. Table: How to export data from Tables
  13. Query: How to change the units
  14. Query: How to export my Query table into Excel
  15. Query: How to save queries
  16. Query: How to retrieve longer historical data series for a dataset
  17. Search Tips
  18. Browser Compatibility
  19. Query: How to create a Pie chart
  20. Query: How to create a Rating chart
  21. Query: How to create a Table
  22. Query: How to create Stacked bar
  23. Query: How to create Stacked column
  24. Query: How to create Area
  25. Query: How to create Column
  26. Query: How to create Bar
  27. Query: How to create Line
  28. Query: How to create Spline
  29. Query: How to create Scatter chart
  30. Query: How to create Bubble chart
  31. Query: How to create Treemap
  32. Query: How to create Map
  33. Query: How to change database from the query tool
  34. How do I get the underlying data in a table or a chart?
  35. Finding Data using Concept Codes
  36. Data Services
  37. Using SDMX 2.0 Web Service
  38. Using SDMX 2.1 Web Service
  39. JSON RESTful Web Service
  40. SDMX 2.0 RESTFUL WEB SERVICE
  41. EZProxy: How to configure on the User side
  42. Table: How to select countries for which I want data
  43. Table: How to select indicators for which I want data
  44. IFS publication in PDF file – where to find
  45. Composition of Current Statistical Groups and Aggregates
  46. Bulk Download: How to extract and view data in Excel?
  47. Data services: how to get the code of a dataset and a list of all dimensions and elements?
  48. Workbook: How to show additional attributes (Country Name, Indicator Name, Database, etc.)?
  49. Workbook: How to add an attribute (Country, Time, Frequency, etc.) to a Series Tree?

Feedback and Knowledge Base