Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

API - Get complete surveys is a specific timerange

  • nicolepe
  • nicolepe's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 4 months ago #191590 by nicolepe
Hi,
I would like to use LimeSurvey to provide surveys and use the results to elaborate results, making personalized graph and reports.

I am able to connect to the server via API and get data of a specific survey and token, using the export_responses_by_token call.

What I would like to obtain, is the list of surveys completed in a timerange (eg. the last 24 hours). Is there a way to use the API and get this list ?

Many thanks,
Nicola.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191597 by tpartner
Assuming the survey is non-anonymous and you are recording the date stamp, you can can use the API export_responses() method with something like this as the $aFields argument:

Code:
$aFields = array('submitdate', 'token');

Then you should be able to filter the results by the submitdate to get the relevant tokens.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: nicolepe
The topic has been locked.
  • nicolepe
  • nicolepe's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 4 months ago #191696 by nicolepe
Hi Tony,
thanks for the reply, unfortunately, this is not what I am looking for.

I have a survey that runs for many days, with many participants. I am developing statistics pages in which I show some data about all the responses received. I would like to be able to update the data each day with the responses of the previous day.

Handling it the way you suggest, will force the system to download all the responses every day and discard all those that are not from a specific day.

I am wondering if there is a way to receive only the responses from a specific day.

Thanks,
Nicola.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191741 by DenisChenu
Maybe it's best to use export_responses
with iFromResponseID by parameters ?

Since there are no filter in export response or export_response by token : you can create your own function : extensions.sondages.pro/development-and-...i/documentation.html

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191746 by tpartner

Handling it the way you suggest, will force the system to download all the responses every day and discard all those that are not from a specific day.

My suggestion would not get all of the response data, it would only get the token and submitdate values - a considerably smaller returned result.

If that doesn't suit you could do it with a direct SQL query.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
3 years 10 months ago #201097 by Rayarltris_192345
Replied by Rayarltris_192345 on topic API - Get complete surveys is a specific timerange
Hi Nicola -- did you end up finding a solution? I'm facing a similar challenge... I have a survey to be completed by individuals from different groups and, for report purposes, I'd like to selectively retrieve responses filtered by group ids (which are captured by a hidden variable).
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #201103 by Joffm
Hi,
as there is no range of responseIDs you want to export, it is not possible to use the two parameters
"$iFromResponseID" and "$iToResponseID"
and Tony's two step approach.

So, you may export all responses and filter by groups in your script, or you may do it by direct access to the database.
Depends on the amount of records.

Because I am not so very familiar with the API I always prefer the direct access where I can query the database according to my needs.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose