Submissions API: "This form is not associated with an app"

Hey Team Dimagi,

I’ve managed to take some generic JSON, replicate the raw XML of a
successful form submission for one of our applications, and post that XML
to:
https://www.commcarehq.org/a/our_app/receiver/submission/

I get the 201, and the submission shows up, but I get the message below and
don’t know how to associate this submission to our app. Any ideas?

Here’s the message from CommCare: “This form is not associated with an app.
All data is listed as Unrecognized Data.”

Here’s the body of my XML post:

<Training_Group_Name>BWC Group C</Training_Group_Name>
Hastings
<n0:case xmlns:n0=“http://commcarehq.org/case/transaction/v2” case_id=
“4dbf3742-38b2-4afb-b122-ea7c1359f473” date_modified=
“2016-05-09T12:55:13.755+02” user_id=“b041ef5a325d7b6c6e19baf70e03b796”>
n0:create
n0:case_nameBWC Group C</n0:case_name>
n0:owner_idb041ef5a325d7b6c6e19baf70e03b796</n0:owner_id>
n0:case_typeTraining_Group</n0:case_type>
</n0:create>
n0:update
n0:CityHastings</n0:City>
</n0:update>
</n0:case>
<n1:meta xmlns:n1=“http://openrosa.org/jr/xforms”>
n1:deviceID188972466304502</n1:deviceID>
n1:timeStart2016-05-09T12:55:06.690+02</n1:timeStart>
n1:timeEnd2016-05-09T12:55:13.755+02</n1:timeEnd>
n1:usernamelexak27</n1:username>
n1:userIDb041ef5a325d7b6c6e19baf70e03b796</n1:userID>
<n2:appVersion xmlns:n2=“http://commcarehq.org/xforms”>
CommCare Android, version “2.27.2”(414569). App v66. CommCare
Version 2.27. Build 414569, built on: 2016-04-28
</n2:appVersion>
</n1:meta>

Thanks for all your help,
Taylor

Hey

You should add the app_id to the post URL:

https://www.commcarehq.org/a/our_app/receiver/submission/<application_uuid>/

Ideally this should be the ID of the app build which the submission
corresponds to so that we’re able to match up the form data with the
version of the app that produced it. That’s only really important for
displaying the data though.

Also looking at you’re XML you should probably set the ‘deviceID’ to
something like ‘openfn’ or something like that. You can probably remove
"appVersion" too since it’s a bit misleading for API submissions.

··· On 11 May 2016 at 16:01, wrote:

Hey Team Dimagi,

I’ve managed to take some generic JSON, replicate the raw XML of a
successful form submission for one of our applications, and post that XML
to:
https://www.commcarehq.org/a/our_app/receiver/submission/

I get the 201, and the submission shows up, but I get the message below
and don’t know how to associate this submission to our app. Any ideas?

Here’s the message from CommCare: “This form is not associated with an
app. All data is listed as Unrecognized Data.”

Here’s the body of my XML post:

<Training_Group_Name>BWC Group C</Training_Group_Name>
Hastings
<n0:case xmlns:n0=“http://commcarehq.org/case/transaction/v2” case_id=
“4dbf3742-38b2-4afb-b122-ea7c1359f473” date_modified=
“2016-05-09T12:55:13.755+02” user_id=“b041ef5a325d7b6c6e19baf70e03b796”>
n0:create
n0:case_nameBWC Group C</n0:case_name>
n0:owner_idb041ef5a325d7b6c6e19baf70e03b796</n0:owner_id>
n0:case_typeTraining_Group</n0:case_type>
</n0:create>
n0:update
n0:CityHastings</n0:City>
</n0:update>
</n0:case>
<n1:meta xmlns:n1=“http://openrosa.org/jr/xforms”>
n1:deviceID188972466304502</n1:deviceID>
n1:timeStart2016-05-09T12:55:06.690+02</n1:timeStart>
n1:timeEnd2016-05-09T12:55:13.755+02</n1:timeEnd>
n1:usernamelexak27</n1:username>
n1:userIDb041ef5a325d7b6c6e19baf70e03b796</n1:userID>
<n2:appVersion xmlns:n2=“http://commcarehq.org/xforms”>
CommCare Android, version “2.27.2”(414569). App v66. CommCare
Version 2.27. Build 414569, built on: 2016-04-28
</n2:appVersion>
</n1:meta>

Thanks for all your help,
Taylor


Simon Kelly
Senior Engineer | Dimagi South Africa

Appologies. The URL should be:

https://www.commcarehq.org/a/our_app/receiver/
https://www.commcarehq.org/a/tns-proof-of-concept/receiver/15cc7c1ae763271e27e8b76b165c055a/
<application_uuid>/

(‘submission’ replaced with ‘app ID’)

··· On 11 May 2016 at 16:14, Simon Kelly wrote:

Hey

You should add the app_id to the post URL:

https://www.commcarehq.org/a/our_app/receiver/submission/
<application_uuid>/

Ideally this should be the ID of the app build which the submission
corresponds to so that we’re able to match up the form data with the
version of the app that produced it. That’s only really important for
displaying the data though.

Also looking at you’re XML you should probably set the ‘deviceID’ to
something like ‘openfn’ or something like that. You can probably remove
"appVersion" too since it’s a bit misleading for API submissions.

On 11 May 2016 at 16:01, taylor@openfn.org wrote:

Hey Team Dimagi,

I’ve managed to take some generic JSON, replicate the raw XML of a
successful form submission for one of our applications, and post that XML
to:
https://www.commcarehq.org/a/our_app/receiver/submission/

I get the 201, and the submission shows up, but I get the message below
and don’t know how to associate this submission to our app. Any ideas?

Here’s the message from CommCare: “This form is not associated with an
app. All data is listed as Unrecognized Data.”

Here’s the body of my XML post:

<Training_Group_Name>BWC Group C</Training_Group_Name>
Hastings
<n0:case xmlns:n0=“http://commcarehq.org/case/transaction/v2” case_id
=“4dbf3742-38b2-4afb-b122-ea7c1359f473” date_modified=
“2016-05-09T12:55:13.755+02” user_id=“b041ef5a325d7b6c6e19baf70e03b796”>
n0:create
n0:case_nameBWC Group C</n0:case_name>
n0:owner_idb041ef5a325d7b6c6e19baf70e03b796</n0:owner_id>
n0:case_typeTraining_Group</n0:case_type>
</n0:create>
n0:update
n0:CityHastings</n0:City>
</n0:update>
</n0:case>
<n1:meta xmlns:n1=“http://openrosa.org/jr/xforms”>
n1:deviceID188972466304502</n1:deviceID>
n1:timeStart2016-05-09T12:55:06.690+02</n1:timeStart>
n1:timeEnd2016-05-09T12:55:13.755+02</n1:timeEnd>
n1:usernamelexak27</n1:username>
n1:userIDb041ef5a325d7b6c6e19baf70e03b796</n1:userID>
<n2:appVersion xmlns:n2=“http://commcarehq.org/xforms”>
CommCare Android, version “2.27.2”(414569). App v66. CommCare
Version 2.27. Build 414569, built on: 2016-04-28
</n2:appVersion>
</n1:meta>

Thanks for all your help,
Taylor


Simon Kelly
Senior Engineer | Dimagi South Africa


Simon Kelly
Senior Engineer | Dimagi South Africa

That works perfectly. Thank you, Simon.

For context, what we’re doing here is using changes in a Salesforce system
to update cases in CommCare. (A bunch of folks use CommCare to Salesforce
integrations, but this is the first time we’re doing a 2-way integration.)

··· On Wed, May 11, 2016 at 4:39 PM Simon Kelly wrote:

Appologies. The URL should be:

https://www.commcarehq.org/a/our_app/receiver/
https://www.commcarehq.org/a/tns-proof-of-concept/receiver/15cc7c1ae763271e27e8b76b165c055a/
<application_uuid>/

(‘submission’ replaced with ‘app ID’)

On 11 May 2016 at 16:14, Simon Kelly skelly@dimagi.com wrote:

Hey

You should add the app_id to the post URL:

https://www.commcarehq.org/a/our_app/receiver/submission/
<application_uuid>/

Ideally this should be the ID of the app build which the submission
corresponds to so that we’re able to match up the form data with the
version of the app that produced it. That’s only really important for
displaying the data though.

Also looking at you’re XML you should probably set the ‘deviceID’ to
something like ‘openfn’ or something like that. You can probably remove
"appVersion" too since it’s a bit misleading for API submissions.

On 11 May 2016 at 16:01, taylor@openfn.org wrote:

Hey Team Dimagi,

I’ve managed to take some generic JSON, replicate the raw XML of a
successful form submission for one of our applications, and post that XML
to:
https://www.commcarehq.org/a/our_app/receiver/submission/

I get the 201, and the submission shows up, but I get the message below
and don’t know how to associate this submission to our app. Any ideas?

Here’s the message from CommCare: “This form is not associated with an
app. All data is listed as Unrecognized Data.”

Here’s the body of my XML post:

<Training_Group_Name>BWC Group C</Training_Group_Name>
Hastings
<n0:case xmlns:n0="http://commcarehq.org/case/transaction/v2"
case_id=“4dbf3742-38b2-4afb-b122-ea7c1359f473” date_modified=
“2016-05-09T12:55:13.755+02” user_id=“b041ef5a325d7b6c6e19baf70e03b796”>
n0:create
n0:case_nameBWC Group C</n0:case_name>
n0:owner_idb041ef5a325d7b6c6e19baf70e03b796</n0:owner_id>
n0:case_typeTraining_Group</n0:case_type>
</n0:create>
n0:update
n0:CityHastings</n0:City>
</n0:update>
</n0:case>
<n1:meta xmlns:n1=“http://openrosa.org/jr/xforms”>
n1:deviceID188972466304502</n1:deviceID>
n1:timeStart2016-05-09T12:55:06.690+02</n1:timeStart>
n1:timeEnd2016-05-09T12:55:13.755+02</n1:timeEnd>
n1:usernamelexak27</n1:username>
n1:userIDb041ef5a325d7b6c6e19baf70e03b796</n1:userID>
<n2:appVersion xmlns:n2=“http://commcarehq.org/xforms”>
CommCare Android, version “2.27.2”(414569). App v66.
CommCare Version 2.27. Build 414569, built on: 2016-04-28
</n2:appVersion>
</n1:meta>

Thanks for all your help,
Taylor


Simon Kelly
Senior Engineer | Dimagi South Africa


Simon Kelly
Senior Engineer | Dimagi South Africa


Taylor Downs | Founder & Core Contributor
OpenFn <www.openfn.org> | Integrated Systems for Development
https://player.vimeo.com/video/143660667