Send data transparently to our server

We would like to use kobo app as a support tool for our web platform. The data entry will be from different sites (using the app) and frequency is daily once. We will not use the kobo web platform for any data handling, we just want the data to move seamlessly to our MySQL database.

All I found in the discussion is to use REST API that will export ALL DATA, but we do not want to export all data, we just want to move ‘new data’ which has not been sent to the server yet.

Any guidance would be helpful.

Hi @mahmudmia
Welcome to the community forum.

Does it mean you will not set up the data to get to our servers first? If that is the case, then your next query would not be possible,

When you pull data via API, you will need to be pulling it from our servers using API. If you however need to bypass our servers completely, then I suggest that you set up KoBoToolbox on your own servers.

Kindly confirm the above.
Stephane

1 Like

You can do this by setting up REST services.

https://support.kobotoolbox.org/rest_services.html

2 Likes

I am sorry, I replied from mail and I do not see my reply here under the thread.

We do want the app to send data to kobo server, and then we want it copied to our server. I have come across this API endpoint -

https://kf.kobotoolbox.org/api/v2/assets/aGVwtSNjWLJmTMnkqHTJeR/data/?format=json

Now, if I enter more data - it will accumulate and the JSON builds up continuously. As our data entry in the app is daily, 300+ facilities, the accumulated JSON becomes unusable soon.

How can we filter by ‘date’, say - ‘give me data of date X’.

I read in different threads that MongoDB query parameters also work, so I tried something like this -

https://kf.kobotoolbox.org/api/v2/assets/aGVwtSNjWLJmTMnkqHTJeR/data/?format=json&query={Date%3A%20{%24gte%20%3A%20"2021-01-30"}}

Literally I want to say get the records with Date field greater or equal ‘2021-01-30’, but this is not working.

If you go to this page it tells you how to query the API:

https://kc.kobotoolbox.org/api/v1/data

The relevant query for what you’re looking for is:

1 Like

Thanks for the hint, but it seems you gave an example with v1 API end point and /data/, which in my case shows ‘not found’. I am getting data using this endpoint -

https://kf.kobotoolbox.org/api/v2/assets/aGVwtSNjWLJmTMnkqHTJeR/data/?format=json

And I could not make use of parameters, struggling for last 2 days. Can anyone help to properly add this parameter to my query - ‘Date >= [certain date]’.

The v1 API should definitely work. What do you see when you go to this page?

https://kc.kobotoolbox.org/api/v1/data

Scroll down to see the data links for the individual forms.

The link to retrieve the data from the form is https://kc.kobotoolbox.org/api/v1/data/form_uid where the form_uid is a numerical value unlike for the v2 API.

1 Like

Thanks a ton! Managed to have the data api running and extracting data with ‘date’ parameter. On interesting finding, instead of the ‘gt$’ which is mentioned in the API page, the following worked ($gt) -

https://kc.kobotoolbox.org/api/v1/data/XXXXXX?query={“Date”: {"$gt": “2020-01-29T01:02:03+0000”}}

2 Likes

Thanks, @mahmudmia for the clarification on the $gt as opposed to gt$. We will countercheck this on our end and commit the change

1 Like