We want to pull out the xform definition via the api (so that we can, for
example, display the questions in the same order as in CommCare, and
present the human readable question text).
We couldn't see how to do this from the commcare documentation on the wiki.
Reading the code, we thought the following looked promising:
If I'm understanding you correctly you just want to get the raw xml
definition file in a given app/module/form?
This is not supported via the APIs yet, although is something we eventually
planning on adding. However it should still be possible to do via the
current URL structure.
For built apps you can find this by going to the release manager and
clicking "deploy" -> view source files. From there you can get links to the
forms and should be able to reverse engineer the url structure.
For unbuilt apps you can replace /view/ in the url with /download/ and get
to the same page.
Note that since this is not an official API the url structure might change
at any time (which would likely break your app). We don't have plans to
change it, but rely on it at your own risk.
I'd recommend switching to the API as soon as we add support for that (and
we'll let you know when that's the case).
Cory
···
On Tue, Feb 12, 2013 at 6:38 AM, Sarah Bird wrote:
Hi all,
We want to pull out the xform definition via the api (so that we can, for
example, display the questions in the same order as in CommCare, and
present the human readable question text).
We couldn't see how to do this from the commcare documentation on the wiki.
Reading the code, we thought the following looked promising:
I'm not seeing a view source files link, when I click deploy? What am I
missing?
Thanks,
Bird
···
On Tue, Feb 12, 2013 at 4:34 PM, Cory Zue wrote:
Hi Sarah,
If I'm understanding you correctly you just want to get the raw xml
definition file in a given app/module/form?
This is not supported via the APIs yet, although is something we
eventually planning on adding. However it should still be possible to do
via the current URL structure.
For built apps you can find this by going to the release manager and
clicking "deploy" -> view source files. From there you can get links to the
forms and should be able to reverse engineer the url structure.
For unbuilt apps you can replace /view/ in the url with /download/ and get
to the same page.
Note that since this is not an official API the url structure might change
at any time (which would likely break your app). We don't have plans to
change it, but rely on it at your own risk.
I'd recommend switching to the API as soon as we add support for that (and
we'll let you know when that's the case).
We want to pull out the xform definition via the api (so that we can, for
example, display the questions in the same order as in CommCare, and
present the human readable question text).
We couldn't see how to do this from the commcare documentation on the
wiki.
Reading the code, we thought the following looked promising:
The build id is a long series of letters and numbers that you can find in
the URL of any of the other deploy links.
Cory
···
On Tue, Feb 12, 2013 at 12:05 PM, Sarah Bird wrote:
Hi Cory,
I'm not seeing a view source files link, when I click deploy? What am I
missing?
Thanks,
Bird
On Tue, Feb 12, 2013 at 4:34 PM, Cory Zue czue@dimagi.com wrote:
Hi Sarah,
If I'm understanding you correctly you just want to get the raw xml
definition file in a given app/module/form?
This is not supported via the APIs yet, although is something we
eventually planning on adding. However it should still be possible to do
via the current URL structure.
For built apps you can find this by going to the release manager and
clicking "deploy" -> view source files. From there you can get links to the
forms and should be able to reverse engineer the url structure.
For unbuilt apps you can replace /view/ in the url with /download/ and
get to the same page.
Note that since this is not an official API the url structure might
change at any time (which would likely break your app). We don't have plans
to change it, but rely on it at your own risk.
I'd recommend switching to the API as soon as we add support for that
(and we'll let you know when that's the case).
We want to pull out the xform definition via the api (so that we can,
for example, display the questions in the same order as in CommCare, and
present the human readable question text).
We couldn't see how to do this from the commcare documentation on the
wiki.
Reading the code, we thought the following looked promising:
Given that I already have cases and forms independent of what build I'm
on, using the build-id seems problematic - where would I get it from? I
can't see it in the case / form data
Second:
The URL is not using a form-unique-id it seems to be using
module-<module_id> & form-<form_id> where module_id and form_id are 0,1 etc
how do I know what the module_id and form_id are for a particular form?
Things I readily know: case_unique_id, xform_unique_id (the form instance
not the form definition), domain_name
Cheers,
Bird
···
On Tue, Feb 12, 2013 at 5:24 PM, Cory Zue wrote:
Hi Sarah,
Apologies, that link actually only shows up for us superusers since it's
not useful to most people and I forgot that.
You can hit the URL directly with the following format:
I'm not seeing a view source files link, when I click deploy? What am I
missing?
Thanks,
Bird
On Tue, Feb 12, 2013 at 4:34 PM, Cory Zue czue@dimagi.com wrote:
Hi Sarah,
If I'm understanding you correctly you just want to get the raw xml
definition file in a given app/module/form?
This is not supported via the APIs yet, although is something we
eventually planning on adding. However it should still be possible to do
via the current URL structure.
For built apps you can find this by going to the release manager and
clicking "deploy" -> view source files. From there you can get links to the
forms and should be able to reverse engineer the url structure.
For unbuilt apps you can replace /view/ in the url with /download/ and
get to the same page.
Note that since this is not an official API the url structure might
change at any time (which would likely break your app). We don't have plans
to change it, but rely on it at your own risk.
I'd recommend switching to the API as soon as we add support for that
(and we'll let you know when that's the case).
We want to pull out the xform definition via the api (so that we can,
for example, display the questions in the same order as in CommCare, and
present the human readable question text).
We couldn't see how to do this from the commcare documentation on the
wiki.
Reading the code, we thought the following looked promising:
Given that I already have cases and forms independent of what build I'm
on, using the build-id seems problematic - where would I get it from? I
can't see it in the case / form data
If you just want the current copy based on the app you can substitute the
app id for the build id.
The URL is not using a form-unique-id it seems to be using
module-<module_id> & form-<form_id> where module_id and form_id are 0,1 etc
how do I know what the module_id and form_id are for a particular form?
This is indexed by the order you see them when editing your app. They are
also referenced by the xform unique id in the suite file if you want to
pull them from there. Like I mentioned, this isn't an official or designed
API so you'll have to do some leg work to make it work.
Feel free to follow up off-list as I don't think this is super relevant to
anyone else.
Cory
···
On Tue, Feb 12, 2013 at 12:39 PM, Sarah Bird wrote:
What is the best way to authenticate a request to that endpoint? When I attempt that request using an API Key, the server replies with a 302 redirect to a login endpoint.
Was support for this feature ever added elsewhere on the API?