I'm working with the kobo REST API and I can get the structure's information from the form and the submitted data through the API, but when I try to send data to the form through a POST service, kobo returns the following message: "Your data for instance None has been already submitted.".
Is there any way to send POST data to a kobotoolbox form using its API?
I tried to send the data with the following POST request:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \
"name": "Foo" \
}' 'https://kf.kobotoolbox.org/assets/{form_id}/submissions/'
Where {form_id}
is the id from my form in kobotoolbox
And the response was:
{
"detail": "Your data for instance None has been already submitted."
}
To submit data you need to POST to
https://[kobocat url]/api/v1/submissions
, e.g.https://kc.kobotoolbox.org/api/v1/submissions
. The endpoint you tried is for retrieving submitted data.This will work (for a form that contains a
first_name
andlast_name
question:<kpi asset ID>
in this case refers to the unique form ID created in kobocat. This ID should be the same as the kpi asset ID, as long as you uploaded/created your form in the regular interface and deployed it.You can find the ID by going to
https://kf.kobotoolbox.org/assets/<kpi asset ID>/
. In my case I get this: