Using the Kobo REST API (https://kc.kobotoolbox.org/api/v1/)

Hi,

This is a general question about the future of the REST API, and the legacy kc.kobotoolbox.org platform in general.

Background / Context
I’m part of a team developing products for use with Kobotools. We’ve been using the REST API to good effect, to help users deploy forms, collect data via Kobotoolbox, then automatically pull data from multiple forms into a single external database.

Specifically, we’re pushing forms by POSTing to /api/v1/forms, sharing forms with /api/v1/forms/{pk}/share, and pulling the data with GET requests to /api/v1/data

Our systems are working well, with the following caveat: All the forms we push only show up in the ‘legacy’ interface (kc.kobotoolbox.org). This is fine, but a bit confusing to users, given the modern interface is the default one.

From discussion with the Kobo team, I learnt this is because the Sync between kc. and kf only works 1-way, so forms uploaded or pushed to the legacy database are not synchronised to the modern database. In addition, the ‘legacy’ interface is being phased out in the coming months.

My Question
Is there an alternate api we should be using, which will be compatible with the “modern” Kobotools interface? I’m a little concerned that if the legacy platform is going away, will the API also stop working? I’d like to get ahead and figure out a better way of linking to the Kobotools platform before that happens!

Any insights from fellow developers and Kobotools power users would be really appreciated,

Thanks,
~ Dave

1 Like

Quick update here:

The help page for the REST API has been recently updated. It now says:

Originally kc was the only api for deploying forms and retrieving data. Now, kpi is the primary API that should be used.

I guess I should now be using https://kf.kobotoolbox.org/ with assets, submissions and exports as described on the help page.

However, the whole API seems quite incomplete (or maybe it’s just the documentation that’s incomplete). Does anyone have any examples of using this new API to do the following tasks:

  • Upload an XLS file (in XLSForm Format) to create a new form/project
  • Share an existing form with another user
  • Retrieve the data collected from a project in JSON format.

If any Kobo devs are reading this, I’m also happy to help test the API if needed, and can help with documentation if it could help others in the future.

Thanks,
Dave.

@Dave, thanks for raising this issue. What will happen to projects designed using xlsform and uploaded to legacy?. We have to also start using the kpi to avoid downtime.

Reverton

… just a note that the https://[kpi-url]/submissions/ endpoint apparently doesn’t exist, returning HTTP 404 and The requested URL /submissions/ was not found on this server..

I confess it’s not clear to me at all if it’s even possible to get the data out with the “new” API.

User @roaima has a helpful post about how to get it with the v1 API, correcting the errors of the documentation:

1 Like

The two articles on the Kobo REST API have over 2k views each. This is an indication that the interest for integrating with Kobo is strong. Is there any plan for documenting the API?

Having implemented my first project on Kobotoolbox, I find the limitations on sharing live reports without access to a full data download a showstopper. When looking for an API to solve this issue via another tool, the next showstopper is the lack of API documentation.

1 Like

Yes! The documentation is a work in progress. Try looking at the v2 endpoints: https://kf.kobotoolbox.org/api/v2/assets/

2 Likes

Hi, I installed kobo toolbox on my server, Do I need to configure anything to be able to access
https://[kpi-url]/api/v2/assets/ Right now I get the error the URL was not found

I get a token here on the below url

https://[kpi-url]/token/?format=json

Note : https://[kpi-url]/ is on my own server and domain name

**