This section explains the metatada API which is available at /api/23/metadata and /api/26/metadata endpoints. 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 .
|fields||Same as metadata field filter||Default field filter to apply for all types, default is :owner .|
|filter||Same as metadata object filter||Default object filter to apply for all types, default is none .|
|order||Same as metadata order||Default order to apply to all types, default is name if available, or created if not.|
|translate||false/true||Enable 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.|
|defaults||INCLUDE/EXCLUDE||Should auto-generated category object be included or not in the payload. If you are moving metadata between 2 non-synced instances, it might make sense to set this to EXCLUDE to ease the handling of these generated objects.|
|skipSharing||false/true||Enabling this will strip the sharing properties from the exported objects. This includes user , publicAccess , userGroupAccesses , userAccesses , and externalAccess .|
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
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 .