Create or Edit the Organizational Structure (Location Data) via the API

There doesnt seem to be any information given on the organizational structure (or location data as its sometimes referred) under the documented APIs. See link below

https://confluence.dimagi.com/display/commcarepublic/CommCare+HQ+APIs

However I know its possible to pull the location data via the API as we have done so in another project we have worked on. However what I am needing to know is it possible to create or even just update location data via the API?

I see there was a similar post previously back in 2018 and Im hoping there is updated information since then, see link below:

Any help would be much appreciated it!

@Ethan_Soergel
@Simon_Kelly
@erobinson

@Mazz
@Norman_Hooper

Do you possibly have any info regarding the above?

Can't say that I do sorry!

Hi @Calvin

You're right. The Location API documentation was missing. I've have added it. You can find it here: Location API - CommCare Public - CommCare Public

Please let me know if there are any more details you think I should add to those docs.

1 Like

Hi @Norman_Hooper,

Thank you so much for your response and adding that. Super appreciated.
Looking at that documentation though its specifies that: "The Location API is read-only. Only the GET request method is supported."

Was really hoping that there was a way to update the location data from the API. Similar to how you can update the lookup table data via the API by passing a correctly formatted excel document (This I have been able to successfully do).

I know the CommcareHQ frontend offers this functionality, see pic below.

Is there no API endpoint that I can use to upload that excel document to update locations, like you can do from the Commcare HQ frontend?

Kind regards,

@erobinson