Importing Data with API


Dear my friends :slight_smile:
have a question please , i have survey at Checkmarket and i nneed to automate downloading its results on a daily basis rather that downloading as excel manually and daily. So i found an API at their API Documentation with the following but i cannot use it in R , Appreciate your kind support in this issue my friends that this will reduce headache of downloading ,manipulating and summarizing it even in weekends and vacations . So API is as follows :slight_smile:
It's available at Checkmarket but don'r know how to use it at R ??
curl "{SurveyId}/respondents?filter=ResponseDate%20ge%20DateTime'2018-03-28'and%20ResponseDate%20lt%20DateTime'2018-03-29'"
-H "X-Master-Key:{MasterKey}"
-H "X-Key:{Key}"
Where Survey , MasterKey and Key are available per user


Hi Hady,

Firstly, could you edit your post and include a reproducible example of what you've got so far and the errors you have?

In terms of advice for working with APIs? I personally like the R package httr.

And I personally like purrr for wrangling xml and json objects. Here's a tutorial from Jenny Bryan on the topic, How to tame XML with nested data frames and purrr


Hi, if this is a generic REST API, you may be able to interact with it in R using the httr package.


Hi @edgararuiz,
i found it but the main problem is that this API contains keys per user , So which package to use API's with keys ??
curl "{SurveyId}/respondents?filter=ResponseDate%20ge%20DateTime'2018-03-28'and%20ResponseDate%20lt%20DateTime'2018-03-29' 1"
-H "X-Master-Key:{MasterKey}"
-H "X-Key:{Key}"


Ok, you may want to check the API authentication section in the website (or vignette) from httr: