Meta-Data Import complains of missing shortname and name

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@gmail.com

+1 (541) 632-6623

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@gmail.com> 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@gmail.com
+1 (541) 632-6623

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

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:

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.xmlhttps://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.

···

On Fri, Aug 7, 2015 at 7:29 AM, Bob Jolliffe bobjolliffe@gmail.com 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@gmail.com 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@gmail.com

+1 (541) 632-6623


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Timothy Harding

RPCV Vanuatu

Skype: hardingt@gmail.com

+1 (541) 632-6623

Well that is an odd message :frowning:

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 :frowning:

···

On 7 August 2015 at 15:55, Timothy Harding <hardingt@gmail.com> 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@gmail.com
+1 (541) 632-6623

On Fri, Aug 7, 2015 at 7:29 AM, Bob Jolliffe <bobjolliffe@gmail.com> 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@gmail.com> 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@gmail.com
> +1 (541) 632-6623
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>

Proper PATCH is only available in DHIS 2.19+, in 2.18 we supported “PATCH” for a single property.

curl -X PATCH -d “{“name”: “updated name”}” -u user:pass http://localhost/api/dataElements/ID/name

Please note that the URL ends with the name of the property you are updating.

···

On Fri, Aug 7, 2015 at 11:48 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Well that is an odd message :frowning:

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 :frowning:

On 7 August 2015 at 15:55, Timothy Harding hardingt@gmail.com 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@gmail.com

+1 (541) 632-6623

On Fri, Aug 7, 2015 at 7:29 AM, Bob Jolliffe bobjolliffe@gmail.com 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@gmail.com 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@gmail.com

+1 (541) 632-6623


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Morten

Yes, unfortunately this particular instances is using 2.18.

Because of the 1 error message per update (1400+) with my current XML file using curl or node.js, I instead I asked the API for a list of dataelements only showing the zerosig status as an XML file:

/api/dataElements.xml?paging=false&filter=zeroIsSignificant:eq:true&links=false&fields=id,name,shortName,zeroIsSignificant

I updated that list of 1400 or so to say FALSE and uploaded that back into the meta data importer. That way, it had the names and shortnames already (and gave no error messages back).

When I uploaded it, it didn’t alter any of the other information for the data elements, it seems strange to require the name and shortname in addition to the UID, but nothing else.

···

On Fri, Aug 7, 2015 at 9:36 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Proper PATCH is only available in DHIS 2.19+, in 2.18 we supported “PATCH” for a single property.

curl -X PATCH -d “{“name”: “updated name”}” -u user:pass http://localhost/api/dataElements/ID/name

Please note that the URL ends with the name of the property you are updating.

Timothy Harding

RPCV Vanuatu

Skype: hardingt@gmail.com

+1 (541) 632-6623


Morten

On Fri, Aug 7, 2015 at 11:48 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Well that is an odd message :frowning:

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 :frowning:

On 7 August 2015 at 15:55, Timothy Harding hardingt@gmail.com 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@gmail.com

+1 (541) 632-6623

On Fri, Aug 7, 2015 at 7:29 AM, Bob Jolliffe bobjolliffe@gmail.com 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@gmail.com 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@gmail.com

+1 (541) 632-6623


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp