We need to create a link to a new submission, where that submission is pre-filled using answers from a previous survey.
I found the online Enketo API documentation for Creating a new Survey
API Params:
* required parameter **`server_url`** is the url of the OpenRosa server your form is hosted on
* required parameter **`form_id`** is the ID of the form listed in https://testserver.com/bob/formList
* optional parameter **`theme`** can be used to centrally override the theme for all subsequent users, or to reset the theme with an empty string value
* optional parameter **`defaults[]`** can be used to dynamically override survey field defaults (`defaults[/path/to/node]=value`)
* headers must include a **valid API key as username in the Authorization header**
The current issue we are having is that this request is always returning a 401 Unauthorized error.
cURL we are using to attempt to get the survey link
curl --user <API_Token>: -g -d "server_url=https://kc.kobotoolbox.org&form_id=<FORM_ID>" https://ee.kobotoolbox.org/api/v1/survey
The API_Token variable is retrieved from the online Kobo dashboard account security page.
(KoboToolbox)
and the FORM_ID is retrieved from the Kobo API endpoint https://kc.kobotoolbox.org/api/v1/forms
We are currently using https://ee.kobotoolbox.org
as the enke.to api domain because that is the domain that a new survey uses when we open a survey from the Kobo dashboard page My Projects -> From Name page -> FORM -> Collect data -> Online-Offline => OPEN
The idea is that we then generate the defaults query parameter based on the users last submission, but we cant even get the Enketo API to generate a blank survey link.
I’m not very experienced with using Kobo or Enketo, and currently it is pretty unclear where I am going wrong because there are too many variable which could potentially be incorrect about our setup.