1.10. Metadata export

This section explains the metatada API which is available at /api/23/metadata and /api/26/metadataendpoints. XML and JSON resource representations are supported.

The most common parameters are described below in the "Export Parameter" table. You can also apply this to all available types by using type:fields=<filter> and type:filter=<filter>- You can also enable/disable export of certain types by setting type=true/false.

Table 1.11. Export Parameter

NameOptionsDescription
fieldsSame as metadata field filterDefault field filter to apply for all types, default is :owner.
filterSame as metadata object filterDefault object filter to apply for all types, default is none.
orderSame as metadata orderDefault order to apply to all types, default is name if available, or created if not.
translatefalse/trueEnable translations. Be aware that this is turned off by default (in other endpoints this is on by default).
locale<locale>Change from user locale, to your own custom locale.

1.10.1. Metadata export examples

Export all metadata:

curl -u user:pass http://server/api/26/metadata

Export all metadata ordered by lastUpdated descending:

curl -u user:pass http://server/api/26/metadata?defaultOrder=lastUpdated:desc

Export id and displayName for all data elements, ordered by displayName:

curl -u user:pass http://server/api/26/metadata?dataElements:fields=id,name&dataElements:order=displayName:desc

Export data elements and indicators where name starts with "ANC":

curl -u user:pass http://server/api/26/metadata?filter=name:^like:ANC&dataElements=true&indicators=true

1.10.2. Metadata export with dependencies

When you want to move a whole set of data set, program or category combo metadata from one server to another (possibly empty) server, we have three special endpoints for just that purpose:

/api/26/dataSets/ID/metadata.json
/api/26/programs/ID/metadata.json
/api/26/categoryCombos/ID/metadata.json

These exports can then be imported using /api/26/metadata.