Form Submissions **************** Implements OpenRosa API |FormSubmissionAPI| .. |FormSubmissionAPI| raw:: html here Submit an XML XForm submission ------------------------------- .. raw:: html
POST /api/v1/submissionsExample ^^^^^^^ :: curl -X POST -F xml_submission_file=@/path/to/submission.xml https://api.ona.io/api/v1/submissions Submit a JSON XForm submission -------------------------------- .. raw:: html
POST /api/v1/submissionsExample ^^^^^^^^ :: curl -X POST -d '{"id": "[id_string]", "submission": [the JSON]} http://api.ona.io/api/v1/submissions -u user:pass -H "Content-Type: application/json" .. note:: The ``[id_string]`` here is in the name of your form as exposed in the Ona UI and the ``id_string`` as per the `Forms API
POST /Example ^^^^^^^ :: curl -X POST http://api.ona.io/[user]/[pk]/submission -H "Content-Type: application/vnd.org.flowinterop.results+json" -d '[FLOIP data]' Here is an example of what will replace ``[FLOIP data]``: :: [ [ "2017-05-23T13:35:37.356-04:00", 20394823948, 923842093, "ae54d3", "female", {"option_order": ["male","female"]} ], [ "2017-05-23T13:35:47.012-04:00", 20394823950, 923842093, "ae54d7", "chocolate", {} ] ] Edit an existing XForm submission --------------------------------- .. raw:: html{user}
/{pk}
/submission
POST /api/v1/submissionsSame request as above for both XML and JSON XForm submission while providing a ``deprecatedID`` and newly generated ``instanceID``. Example ^^^^^^^^ :: curl -X POST -d '{"id": "[id_string]", "submission": [the JSON]} http://api.ona.io/api/v1/submissions -u user:pass -H "Content-Type: application/json" .. important:: When editing an existing submission, ``deprecatedID`` needs to be provided as one of the meta fields. ``deprecatedID`` is the instanceID of the submission which is being updated and ``instanceID`` is the newly generated ``instanceID``. See |OpenRosaMetaDataSchema| for more details. .. |OpenRosaMetaDataSchema| raw:: html OpenRosa MetaData Schema Here is some example JSON provided for updating an exisiting instance, it would replace `[the JSON]` above: :: { "transport": { "available_transportation_types_to_referral_facility": ["ambulance", "bicycle"], "loop_over_transport_types_frequency": { "ambulance": { "frequency_to_referral_facility": "daily" }, "bicycle": { "frequency_to_referral_facility": "weekly" }, "boat_canoe": null, "bus": null, "donkey_mule_cart": null, "keke_pepe": null, "lorry": null, "motorbike": null, "taxi": null, "other": null } }, "meta": { "instanceID": "uuid:f3d8dc65-91a6-4d0f-9e98-802128083390", "deprecatedID": "uuid:f3d8dc65-91a6-4d0f-9e97-802128083390" } }