Submitting form using XML file via API to /receiver/ endpoint appears to be breaking the form

We have some forms that were submitted by mobile workers from the Android app. We want to edit a couple of values on those forms and resubmit them using the API, but when we submit the file via API, it appears the data no longer recognized by the app.

To explain the process - I get the form ID and then the form XML from reports -> submission history and end up with a URL like this for a single form submission:
/a/my-project/reports/form_data/12345678-1234-5678-9012-123456789012/

The data shows up fine: e.g.

On that page, I go to the "raw XML" tab:

...however, if I copy that raw XML, paste it into a file (e.g. called fix1.xml) and make a small edit then resubmit it using the /receiver/ endpoint like this:

curl -F "xml_submission_file=@fix1.xml" "https://www.commcarehq.org/a/my-project/receiver/" -u myuser@mydomain.com -v

The record appears to somehow get corrupted. If I look at form properties, it shows all data listed as unrecognized data (e.g. below)

The raw XML tab looks like this:

Whats curious is that I get the same results if I simply copy the XML and submit it without editing anything.
Is there something obvious I'm doing wrong here?

Thanks!

This appears to be related to how the form XML is being processed when submitted through the /receiver/ endpoint. A few things to check:

1. XML Namespace and Structure

When you download the raw XML and resubmit it, the form may be missing required wrapper elements or namespace declarations that CommCare expects. The /receiver/ endpoint expects forms in a specific format.

2. Form Deprecation

If you've made changes to your form definition in the app builder since the original submission, resubmitting old form data might cause it to be unrecognized. Check if the form version in the XML matches a currently deployed version.

3. Proper Submission Method

Instead of using the /receiver/ endpoint directly, consider using the Form Submission API which is the recommended way to programmatically submit form data. You can find documentation in the knowledge base under API documentation.

4. Edit Form Submissions Feature

CommCare has a built-in Edit Form Submissions feature that might be more appropriate for your use case. This allows you to edit submitted forms through the UI without having to download, modify, and resubmit XML files.

However, since you're experiencing data corruption even when resubmitting the XML without any edits, this indicates a potential issue with how the /receiver/ endpoint is processing the raw XML export. This could be a bug or an undocumented requirement for the XML format.

Next Steps:

Please submit a support ticket at Jira Service Management with:

  • Your project space name
  • The form ID you're testing with (the one in your example: 12345678-1234-5678-9012-123456789012)
  • A sample of the XML file you're submitting
  • The exact curl command you're using (with sensitive info redacted)
  • Screenshots showing the before/after state (which you've already captured)

The support team can investigate whether there's a specific XML formatting requirement or if this represents a bug in the /receiver/ endpoint's handling of raw XML exports.

This has been resolved, the correct endpoint for submitting the form is https://www.commcarehq.org/a/my-project/receiver/application-ID/

I had left off the application ID - get it from the application URL when visiting CommCare HQ → Applications → [your app]

Detailed under the "Submitting for a Specific Application" heading int he docs:

2 Likes