Submitting Data via Form Submission API

Dear CommCare Community,
I am trying to setup an integration between DHIS2 and CommCare via! Sending data from CommCare via OpenFn by setting up “Data Forwarding” works just as expected. Also sending a payload from to CommCare’s Form Submission API works just fine. I setup Data Forwarding for a form being sent from OpenFn so it is easy for me to verify that the form was succesfuly submitted since the payload gets sent back to! But the challenge is that the submitted data(form) is not available in CommCareHQ’s “Form Exports” whenever the data is exported for that particular form.

Is there anything I need to learn to make a complete payload for CommCare? Also I have checked the documentation, but it is not clear how to prepare the payload for the form submission that creates a new case, a form submission that updates a case and a form submission that is not attached to case management.

Please see the payload I am sending from to CommCare:

Any help will be greatly appreciated.
Thanks and kind regards,

Hi Chaiwa,

By default, CommCare’s exports only support forms made in CommCare HQ. One way to work around this would be to create a “fake” form in an application on CommCare HQ that matches the same data fields you plan to submit from OpenFN, and then use the same xmlns in your submissions as that form. Since it sounds like you’re a developer, another option would be to use the data export tool to export the data.

Regarding case management, I assume that you’re creating the XML by hand, right? If that is the case you’ll want to read and understand the Case XML 2.0 spec, which should have all the information you need.


Hi Cory,
Thank you for this information, appreciated. My ultimate goal is to be able to pull data from DHIS2 into CommCare(seamlessly) via some integration service such as So exactly what you mentioned, for testing purposes, I have created a form in CommCare and then I create the payload in that has all the fields expected by that form.

The form is getting submitted into CommCare with no issues, but Iam wondering why I can’t see the data in the form exports! That is the main problem as at now…So I am suspecting that maybe I am missing out certain metadata/fields that CommCareHQ expects to be able to fit the submitted data into its data management/reporting structures/definitions.

The documentation on CommCare Form Submission API is very basic and clear enough to enable one to post a basic form, but it doesn’t highlight such potential issues as this one and what configuration parameters are available for other variations of form submissions(form to create new case, form to update case, or form without case management).

Would you guide?
Thanks and kind regards,

Dear Cory,
I must say the documentation you shared about Case XML Spec is very helpful and has given me a better understanding of how to play around with various ways of constructing a form.

I just need the mystery behind not showing data in the exports! :slight_smile:


Hey Chaiwa,

For the exports you should:

  1. Make sure you make sure you are using the same xmlns as the form created in your app. The xmlns can be viewed under the advanced “view source” option in form builder.
  2. Make sure you are including a properly formatted meta block in your form.

One simple way to create a template for your submission would be to submit data from the app you have created and then use the submit history report to inspect the generated XML.