1.27 Documents

References to files can be stored with the document resource.

Document fields
Field name Description
name unique name of document
external flag identifying the location of the document. TRUE for external files, FALSE for internal ones
url the location of the file. URL for external files. File resource id for internal ones (see section_title )

A GET request to the documents endpoint will return all documents:

/api/29/documents

A POST request to the doucuments endpoint will create a new document:

curl -X POST -d @document.json -H "Content-type: allication/json"
  http://dhis.domain/api/29/documents

{
  "name": "dhis home",
  "external": true,
  "url": "https://www.dhis2.org"
}

A GET request with the id of a document appended will return information about the document. A PUT request to the same endpoint will update the fields of the document:

/api/29/documents/<documentId>

Appending /data to the GET request will return the actual file content of the document:

/api/29/documents/<documentId>/data