dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38850
Re: Meta-Data Import complains of missing shortname and name
Hi Tim. Are you using PATCH for this update operation? This works
well if you just need to update a particular set of fields, not the
entire dataelment (for which you would use POST and include mandatory
fields like name and shortname). For example:
curl -X PATCH -d "{\"code\": \"VCCT_6\"}" -H "Content-Type:
application/json" -u admin:district
https://apps.dhis2.org/demo/api/dataElements/LgYtBqVkADK
will update the code field on the dataelement with id=LgYtBqVkADK.
Note no name or shortname required.
Similarly with the following xml in dataelement.xml:
<dataElement xmlns="http://dhis2.org/schema/dxf/2.0"
code="VCCT_6" />
The following will update the dataelement:
curl -X PATCH -d @dataelement.xml -H "Content-Type: application/xml"
-u admin:district
https://apps.dhis2.org/demo/api/dataElements/LgYtBqVkADK
On 7 August 2015 at 15:14, Timothy Harding <hardingt@xxxxxxxxx> wrote:
> Hello DHIS2 Devs,
>
> Trying to update a single element as a test and the xml file I've generated
> complains that I'm missing "shortname" and "Name". It ends up updating the
> correct element based on id all the same. If I provide a name and shortname
> it overwrites them!? (but gives no errors).
>
> Can we drop the requirement/error message for "name" and "shortName" if the
> xml file has a unique id, such as "id" or "code"?
>
>
>
> Timothy Harding
> RPCV Vanuatu
> Skype: hardingt@xxxxxxxxx
> +1 (541) 632-6623
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
Follow ups
References