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/
...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:
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?
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.
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.