ok waiting your solution please.
Hi @Mujahid_Aliyu, @ahmaddiab, we are looking into a solution for this In the meantime, I have found a workaround that you can use.
Please go to the following URL and use DownThemAll from there:
https://[kf_url]/api/v2/assets/[asset_uid]/data
So for example, if you are on the HHI server, kf_url
will be kf.kobotoolbox.org
and on OCHA it will be kobo.humanitarianresponse.info
. Your asset_uid
is the id of your project, something like aC34iDewbTEGGVbbSREsXy
.
The page will look like this:
From that page, the DownThemAll extension is able to pick up the media URLs to download
Many thanks for your help, while we await the issue to be resolved.
Hi @Mujahid_Aliyu, @ahmaddiab, another workaround, not using DownThemAll, could be to do something like this from your terminal:
TOKEN="your_secret_token"
curl -s "https://[kf_url]/api/v2/assets/[asset_uid]/data.json" \
-H "Authorization: Token $TOKEN" \
> data.json
for URL in $(cat data.json | jq '.results[]._attachments[].download_url' | sed s/\"//g); do \
FILENAME=$(echo $URL | awk -F "%2F" '{print $(NF)}'); \
wget "$URL" -O "$FILENAME" --header="Authorization: Token $TOKEN"; \
done
Hey Josh thanks for your help , my page Freeze when i tried to load more.
Dear Kal ,
Please any update regarding this issue , the workarround that josh gave its very difficult and im not sure if im still downloading all data needed , i will prefer if the dowloadthem all work through the main data table , this issue is delaying our team productivity i hope you can give it high priority .
please because as today im not able to download anything and the API page giving 502 Bad Gateway error , i will wait the solution from your side ASAP .
Thanks .
Hi @ahmaddiab, there is unfortunately no deployed change yet. You can try loading the API page with a limit
parameter and then using start
to paginate through your submissions:
https://[kf_url]/api/v2/assets/[asset_uid]/data?start=0&limit=100
Dear Kal/Josh ,
Please any update about the issue , when we excpect the solution .
Thanks .
Hi @ahmaddiab, there has been no update yet. Have you tried the suggestion in my previous message?
Hi @ahmaddiab, I’ve cobbled together a rough Python script for media downloads here that you can use. It will skip already downloaded media so you don’t have to download everything every time:
hi Josh,
Sorry but seems im not familiar with coding ,
can you please find for me a way that i can get only data for specific submittied date using API way !.
Hi @ahmaddiab, you can do this as follows:
If you want to download media from the date 2021-09-26
:
https://[kf_url]/api/v2/assets/[asset_uid]/data/?query={"$and":[{"_submission_time":{"$gte":"2021-09-26"}},{"_submission_time":{"$lt":"2021-09-27"}}]}
Then use DownThemAll from on that filtered set of data
its giving me : 502 Bad Gateway
nginx/1.19.10