KoBoCAT REST API - Submissions

I installed the KoboToolbox on my server. I want to create new record via KoBoCAT REST Api http://kc.kobo.local/api/v1/submissions.

Here is the payload data:

{
    "id": "2",
    "submission": {
        "New_Question": "From API"
    }
}

The response:

{
    "error": "Improperly formatted XML."
}

Does anyone know how to fix this?
Thanks.

Hi @sanitasihalt,

Please review the topic below, your JSON structure is wrong, you need to use a specific JSON format. Error 500 on Data Import with Python - #7 by surveyorjr

1 Like

Hi @osmanburcu

Which keys are mandatory? as you know maybe we have different set of survey question.

id, submission, and uuid part is mandatory to choose the correct form, as well as id, uuid for the correct submission

{
  "id": "<my_form_id>",
  "submission": {
    "formhub": {
      "uuid": "form_uuid"
    },
    "start": "172938293",
    "end": "172938293",
    "Date": "3/8/2023",
    "location_note": "",
    "country": "ZW",
    "adm_one": "ZW13",
    "adm_two": "ZW1303",
    "adm_three": "ZW130309",
    "adm_four": "",
    "Village_Name": "Example Village",
    "Location_Coordinates": "-19.947651666666665 30.6872 1183.2 21.125",
    "_Location_Coordinates_latitude": "-19.94765167",
    "_Location_Coordinates_longitude": "30.6872",
    "_Location_Coordinates_altitude": "1183.2",
    "_Location_Coordinates_precision": "21.125",
    "Pillar": "rtsl",
    "Project": "rra",
    "Types_of_Participants": "farmers",
    "Other_Participant_Type": "",
    "Group_Name": "",
    "random_number": "13105",
    "Total_number_of_partificants" :"2",
    "Group_name": {
                     "Participant_ID": "ZW1303_223700626",
                    "Full_name": "Person Name",
                    "Gender": "Male",
                    "Date_of_Birth": "6/2/1982",
                    "Age": "",
                    "participant_age": "41",
                    "Position": "ordinary",
                    "Organisation": "",
                    "National_ID_Number": "7392",
                    "Mobile_Phone_Number": "7712345687",
                    "Country": "ZW",
                    "Specify": ""},
    "_id": "223700626",
    "_uuid": "32780e14-9c5f-49e8-b568-ec37e0153849",
    "_submission_time": "########",
    "_validation_status": "",
    "_notes": "",
    "_status": "submitted_via_web",
    "_submitted_by": "",
    "__version__": "vApGFsoZmEWyyUVW7igvCj",
    "_tags": "",
    "_index": "7778"
  }
}
1 Like