API for form definition

Hi everyone,

We are just beginning to use Commcare-HQ for one of our clients and wanted
to know if its possible to dynamically define forms within commcare-HQ
through some API calls. I believe the forms can be defined in XML format
however looking at the API i have not been able to figure out a way to do
it. In one of the posts in this forum i read about an unofficial API to
access the xform from the server (the reverse of what we are looking
at)...is there any such unofficial API to accomplish the task we are
targeting?

Thanks and Regards
Zaineb

Hi Zaineb,

There is not currently an API to push forms in to CommCare. However, you
can manually upload your own forms in the form designer by clicking on your
form and the selecting "Upload" in the "Form Questions (XForm)" section.
From what I know of your use case, it shouldn't be worth the time to try
to implement something programmatically unless you are planning to create
your own xform designer.

thanks,
Jonathan

··· On Sat, Mar 23, 2013 at 2:18 PM, wrote:

Hi everyone,

We are just beginning to use Commcare-HQ for one of our clients and wanted
to know if its possible to dynamically define forms within commcare-HQ
through some API calls. I believe the forms can be defined in XML format
however looking at the API i have not been able to figure out a way to do
it. In one of the posts in this forum i read about an unofficial API to
access the xform from the server (the reverse of what we are looking
at)...is there any such unofficial API to accomplish the task we are
targeting?

Thanks and Regards
Zaineb

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Zaineb,

Jon's correct that we don't have a supported API, so the solution may
change in the future. But currently, the following should work:

curl -v --digest -u ${email} "https://www.commcarehq.org/a/${domain}/apps/
edit_form_attr/${app_id}/${form_id}/xform/" -F "xform=@${filepath};type=
multipart/form-data"

You will have to reverse engineer the exact url (form_id isn't something
that's super easy to find) by saving once per form and keeping track of
which url it POSTs to by watching the Network tab in Chrome (or similar dev
tool in Firefox). Good luck!

Cheers,
Danny

··· 2013/3/25 Jonathan Jackson

Hi Zaineb,

There is not currently an API to push forms in to CommCare. However, you
can manually upload your own forms in the form designer by clicking on your
form and the selecting "Upload" in the "Form Questions (XForm)" section.
From what I know of your use case, it shouldn't be worth the time to try
to implement something programmatically unless you are planning to create
your own xform designer.

thanks,
Jonathan

On Sat, Mar 23, 2013 at 2:18 PM, zaineb.suleman@gmail.com wrote:

Hi everyone,

We are just beginning to use Commcare-HQ for one of our clients and
wanted to know if its possible to dynamically define forms within
commcare-HQ through some API calls. I believe the forms can be defined in
XML format however looking at the API i have not been able to figure out a
way to do it. In one of the posts in this forum i read about an unofficial
API to access the xform from the server (the reverse of what we are looking
at)...is there any such unofficial API to accomplish the task we are
targeting?

Thanks and Regards
Zaineb

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.