The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset access » Accessing DHS data using API.
Accessing DHS data using API. [message #2772] Fri, 22 August 2014 06:26 Go to next message
adiallo5 is currently offline  adiallo5
Messages: 1
Registered: March 2013
Location: Tunis
Member
Hi,
I am trying the stata code example shown in the following link ( http://api.dhsprogram.com/?utm_content=buffer57c2d&utm_m edium=social&utm_source=twitter.com&utm_campaign=buf fer#/samples-stata.html).
However, when trying this, Stata responds:

. * Call the API and get just the variables of interest
. insheetjson surveyid value using "http://api.dhsprogram.com/rest/dhs/data/20171000,KE.j
> son", table(data) col(SurveyId Value)
Unable to find data. Bad result selector 'data'?
Empty result returned; Nothing to do.


My question is:
- how to get the data values or references - I don't know if this phrased correctly - (in this case, "20171000,KE").
- is there a link or table somewhere with the list of countries, data, indicators, etc., and their reference?

I hope this is clear enough.

Best regards.

Amadou-
Re: Accessing DHS data using API. [message #2786 is a reply to message #2772] Mon, 25 August 2014 10:28 Go to previous messageGo to next message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 787
Registered: January 2013
Senior Member
Amadou,

We had a small mistake in the Stata example. In the example, where we had "table(data)" it should have been "table(Data)" as capitalization is important in Stata. This was due to a change in the names of the fields returned by the API.

The example has been corrected on the web site.

Regards. Trevor
Re: Accessing DHS data using API. [message #2790 is a reply to message #2772] Mon, 25 August 2014 12:52 Go to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 787
Registered: January 2013
Senior Member
Hi Amadou,

I didn't answer your question completely. You can use the following queries to get the lists of:

Indicators: http://api.dhsprogram.com/rest/dhs/indicators
Surveys: http://api.dhsprogram.com/rest/dhs/surveys
Countries: http://api.dhsprogram.com/rest/dhs/countries
add ?f=html if you want to see any of these in a web browser.

You can use these calls in Stata in the same way as the data call.

Previous Topic: dataset
Next Topic: Zambia MIS 2012 dataset
Goto Forum:
  


Current Time: Thu Mar 28 16:18:06 Coordinated Universal Time 2024