KPI V1 API calls (endpoints) not working!

REST service / API calls not working on kc.kobotoolbox.org

Get this message in the screenshot above, for any REST API call, for instance https://kc.kobotoolbox.org/api/v1/data/<xform_id>.json.

Has anyone else encountered this problem? Is this because of the server maintenance/upgrade currently in progress?

Hello @JackieM, @Kal_Lam

REST service (KPI v1 API calls?) are currently not working, for instance https://kc.kobotoolbox.org/api/v1/forms.json

This has started happening after this new release was deployed.

Can you please help? This is an urgent problem…all our forms require REST service

Thank you for brining this to our attention. Let me test this issue quickly. Will get back to you soon.

@Kal_Lam, any update on this problem?

Hi @aaj, I just made a quick check with the REST Services on the Global Server and can confirm that it’s working smoothly for me. No issues at my end. Are you on the Global Server?

This is the URL I’m using:
https://kc.kobotoolbox.org/api/v1/forms.json

Our account is on https://kf.kobotoolbox.org. Think that is the global server?

@aaj, why would you not try using the v2 API instead of using the v1 which will be deprecated soon:

image

For more details see this release note.

Maybe try exploring this v2:

https://kc.kobotoolbox.org/api/v2/

The API calls needed do not work with v2. For instance,

https://kc.kobotoolbox.org/api/v2/forms.json displays this message:

Same result for other API calls needed.

Is there a different URL to get the forms.json and other metadata information with v2 API?
I also use,
https://kc.kobotoolbox.org/api/v1/data/<xform_id>.json
https://kc.kobotoolbox.org/api/v1/metadata/<mediafile_id>.json
among others.

Is there documentation/instructions for accessing form metadata and submission data using v2 API?

v1 API is being used in a PHP implemented REST service processing module on our server to refresh (delete and re-upload) updated csv data (media) files ā€œattachedā€ to one or more kobotoolbox forms

Dear @Kal_Lam,

  • I see that the url https://kc.kobotoolbox.org/api/v2/assets/ provides assets metadata information similar to https://kc.kobotoolbox.org/api/v1/forms.json (v1 API) which we are currently using.
  • However, switching to v2 API will require weeks, probably more, of work. v1 API (what has been used) works on xform_id, which is not available in v2. Also, the v2 asset url formats look very different from v1.
  • The ā€˜auto refresh’ (delete and re-upload) of choices csv data files in forms is a key functionality in our implementation across all our forms. It does not work without it.
  • The v1 API based implementation was done over 3 years ago, and has been working smoothly up till now.
  • The Release 2.025.02 note states that KPI v1 endpoints are to decommissioned (is that same as deprecated?) in early 2026. So, v1 API should be available for use till then? We will then have enough time to switch our implementation to v2.

Any response/update regarding this issue, @Kal_Lam? Any idea when the v1 API (KPI v1 endpoints) will start working again? This is critical for our data collection system to work, which has been on hold for a day now.

@Kal_Lam, any update? Is any one working on this problem??

Hello @degami, @bert12, @NTBG, @OlivierL

Found you on this old post from some years go:

Sorry to bother you, but … are any of you using the V1 API?

It has stopped working after the latest Release 2.025.02.

I use the following V1 KPI URLs:
https://kc.kobotoolbox.org/api/v1/forms.json
https://kc.kobotoolbox.org/api/v1/metadata/<mediafile_id>.json

They all return a Server Error (500) message. Please see my previous posts in this topic for more details.

thank you

FYI I can confirm that I can see the same behavior on Global (kc.kobotoolbox.org) v1 endpoints. Sometimes forms.json works fine, but often it seems to be failing with a 500. :confused:

Investigating.. But can you please retry a few times and see if it will (eventually) work for you too.

@aaj I’m afraid we’re not using the v1 APIs any more - we haven’t done so in a few years. Sorry!

Thanks for the follow-up @Xiphware. I have been constantly checking forms.json since the last one and a half days (did it again just now). It has not worked for me once in that period. Curious that it works for you sometimes. I experienced that behaviour with https://kc.kobotoolbox.org/api/v1/metadata just about an hour ago. It worked a couple of times, then stopped working.

@degami, are y’all using v2 APIs?

@aaj, @degami kindly please be informed that we are investigating this issue and will get back to you once we resolve it. Thank you for your kind patience and understanding!

1 Like

Yep - for our Kobotoolbox-based projects we’re all in on the v2 API. But our setup back when we swapped was pretty scrappy and used for mostly small-scale projects, so it wasn’t that much work to move over.

1 Like

So, the issue of v2 api request returning html instead of json has been resolved?

I have been experimenting with v2 API. Just found out that adding the query string ā€˜?format=json’ to the api request url, returns a json result. However ā€˜?format=json’ query string gets added to all the url values in the returned json result.

A fix was pushed to global a few hours ago, so both forms.json and metadata v1 endpoints should be behaving correctly now.

 % curl -s -H "authorization: Basic $BASE64" "$API/forms.json" | jq .
[
  {
    "url": "https://kc.kobotoolbox.org/api/v1/forms/2159123.json",
    "formid": 2159123,
    "metadata": [],
    "owner": "tiritea",
    "public": false,
    "public_data": false,
    "require_auth": true,
    "tags": [],
    "title": "Enketo 1 Test",
    "users": [
      {
        "user": "tiritea",
        "permissions": [
          "add_datadictionary",
          "add_xform",
          "change_datadictionary",
          "change_xform",
          "delete_data_xform",
          "delete_datadictionary",
          "delete_xform",
          "move_xform",
          "report_xform",
          "transfer_xform",
          "validate_xform",
          "view_xform"
        ]
      }
    ],
    "hash": "md5:b55393598e9b9ebae380cd4a2f5142eb",
    "date_created": "2024-08-12T04:25:07.385027Z",
...


curl -s -H "authorization: Basic $BASE64" "https://kc.kobotoolbox.org/api/v1/metadata/3204642.json" | jq .
{
  "id": 3204642,
  "xform": 2512749,
  "data_value": "small.jpg",
  "data_type": "media",
  "data_file": "XXX",
  "data_file_type": "image/jpeg",
  "file_hash": "md5:efe1c3b6202f70255d43a932b997721f",
  "url": "https://kc.kobotoolbox.org/api/v1/metadata/3204642.json",
  "from_kpi": true,
  "data_filename": "small.jpg"
}

Thanks for your patience. If you see any further issues with the v1 endpoints (or any others for that matter!) please post back.

Happy Easter! :rabbit_face:

1 Like