API for creating a case

Hi all,

Is there an API for creating a case? I didn’t see one.

Assuming there isn’t, it looks like the best way to do this is to generate
some XML files and use the submission API. (In a way this is the ‘API’ for
creating cases). Using a successful form that creates a case as an example:

https://www.commcarehq.org/a/mgh-india-troubleshooting/reports/form_data/502f59f9-84ed-45fd-a97b-81e3ba59ade0/

it looks like I would just need to change “case_id” and the specific case
data in “n0:create” and “n0:update”, correct? What is the instanceID? Can I
leave that constant?

For the case_id, is there a specific pattern I need to follow? Looks like
8-4-4-4-12 random characters using 0-f. I briefly looked for the CCODK
source to see how it’s generated there, but it doesn’t seem to be up on
Dimagi’s github site? (or I missed it)

Thanks,
Brian

Ok, many thanks to Ray Brunsting of Tula Salud. Here’s what I learned:

  • instanceID is the uuid for form_id.
  • And, apparently the format used for case_id and form_id is the default
    output to the uuidgen linux command.
  • generating XML and submitting it to CCHQ is the current way folks create
    cases.

Jeremy Wacksman also pointed out:

Will give it a go a bit later, but seems like I’m all set.

Thanks community!
Brian

··· On Tue, Apr 23, 2013 at 8:53 AM, Brian DeRenzi wrote:

Hi all,

Is there an API for creating a case? I didn’t see one.

Assuming there isn’t, it looks like the best way to do this is to generate
some XML files and use the submission API. (In a way this is the ‘API’ for
creating cases). Using a successful form that creates a case as an example:

https://www.commcarehq.org/a/mgh-india-troubleshooting/reports/form_data/502f59f9-84ed-45fd-a97b-81e3ba59ade0/

it looks like I would just need to change “case_id” and the specific case
data in “n0:create” and “n0:update”, correct? What is the instanceID? Can I
leave that constant?

For the case_id, is there a specific pattern I need to follow? Looks like
8-4-4-4-12 random characters using 0-f. I briefly looked for the CCODK
source to see how it’s generated there, but it doesn’t seem to be up on
Dimagi’s github site? (or I missed it)

Thanks,
Brian