← Back to team overview

dhis2-devs team mailing list archive

Re: Meta-Data Import complains of missing shortname and name

 

Well that is an odd message :-(

What version of dhis are you using?  PATCH functionality was
implemented in March this year, so is only available from v2.19
onwards.  Unfortunately if you are using 2.18 or below you are out of
luck with this approach :-(


On 7 August 2015 at 15:55, Timothy Harding <hardingt@xxxxxxxxx> wrote:
> Hello Bob,
>
> I hadn't tried that one before, thanks for the suggestion and how to!
>
> So I made an xml file with the following:
>
> <dataElement xmlns="http://dhis2.org/schema/dxf/2.0";
> zeroIsSignificant="false" />
>
> and called it zerosig2.xml
>
> Then here is my curl command and the resulting output (gives an error) any
> ideas?
>
> dhis@tmctpsql:~$ curl -k -X PATCH -H "Content-Type: application/xml" -u
> admin:district -d @zerosig2.xml
> "https://192.168.0.110:8443/dhis/api/dataElements/H16LuF5EtZL";
> org.hisp.dhis.filter.MetaDataFilter does not exist: dataElements
>
> If I navigate to that URL directly in a web browser it pulls the data
> element in question right up.
>
> Timothy Harding
> RPCV Vanuatu
> Skype: hardingt@xxxxxxxxx
> +1 (541) 632-6623
>
> On Fri, Aug 7, 2015 at 7:29 AM, Bob Jolliffe <bobjolliffe@xxxxxxxxx> wrote:
>>
>> 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