Open frenzymadness opened 1 year ago
I've might found the code handling this in: https://github.com/kobotoolbox/kobocat/blob/72145d78e33818bae06c7cd8a376fe23deb95f97/onadata/libs/utils/csv_import.py#L61
I've tried to create a minimal reproducer, but the following lines work fine with the exported file:
>>> import unicodecsv as ucsv
>>> csv_file = open("XXX.csv", mode="rb")
>>> csv_reader = ucsv.DictReader(csv_file)
>>> for row in csv_reader:
... print(row)
...
Hello @frenzymadness,
This issue is related to Kobocat and API v1
which has been deprecated for a while.
Please open an issue there https://github.com/kobotoolbox/kobocat/ and close this one.
TBH, the error may not be fixed (since the API is deprecated) or will be considered a (very) low priority and may take a while.
Due to the small size of our team and large volume of users, we cannot provide support or guidance via GitHub issues. Please use the community forum to seek for help.
Thank you very much for the response. I had a discussion about this on the community forum and it seems that csv import is really not functioning properly now. What is kinda confusing to me is that if v1 of API is deprecated, where I can find documentation for v2? When I try to visit https://kc.kobotoolbox.org/api/v2/ it redirects me back to v1 and there id no notice about it being deprecated.
API v2
is located at https://kf.kobotoolbox.org/api/v2/ (different domain name)
I've transferred the issue to the appropriate repository.
Description
I’m trying to import some data to an existing form and the response I’m getting from API is HTTP/500 with full HTML content which is not expected from an API.
Steps to Reproduce
curl -v -X GET https://kc.kobotoolbox.org/api/v1/forms/XXX.csv
curl -v -X POST https://kc.kobotoolbox.org/api/v1/forms/XXX/csv_import -u "user:pass" -F csv_file=@/home/user/XXX.csv
Expected behavior
Import is successful and if there is an error in the imported data, a meaningful error message is returned by the API.
Actual behavior
HTML page with HTTP/500 error.
Additional details
I need to import a few hundred of responses from our previous system so I wanted to learn about the structure of the CSV file expected by the kobo toolbox for the given form so I thought that the simple export/import should work. Is there any documentation of what should be in the CSV file one wants to import? It's obvious for responses to the questions from the form but less obvious for columns like
_id
or_uuid
.