Description Usage Arguments Details Value Examples
View source: R/build_endpoint.R
Short hand to modify a 'DHIS2 like' resource endpoint or an API link from R. This is useful when defining or modifying a DHIS2 API link.
1 2 3 4 5 6 7 8 |
endpoint |
A DHIS2 resource or on an API endpoint link, for example 'dataElements' or 'api/dataElements'. |
id |
The unique identifier of an object in the endpoint, a character string of size 11. |
ref |
An endpoint reference, a character string. |
ref_id |
The unique identifier of an object in the referenced endpoint, a character string of size 11. |
version |
A version of the web API. |
... |
Additional parameters passed to the |
modify_endpoint
defines or modifies an API link from an endpoint or API
params. It parses the API parameters first into a list before building the API
link.
A URL, a DHIS2 web API link.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | modify_endpoint() # default api link
modify_endpoint(endpoint = "dataElements") # point to dataElements endpoint
# refer to a specific dataElement object
modify_endpoint(endpoint = "dataElements", id = "ID")
# modify an object ID of an API link, `api/dataElements/ID`
modify_endpoint(endpoint = "api/dataElements/ID", id = "ID2")
# modify the version of an API link, `api/dataElements/ID`
version <- 29L
modify_endpoint(endpoint = "api/dataElements/ID", version = version)
# select data elements name, id and shortNames
modify_endpoint(endpoint = "dataElements", fields = c("name", "id", "shortNames"))
# arrange the data elements name in ascending order
modify_endpoint(
endpoint = "dataElements", fields = c("name", "id", "shortNames"),
order = api_order("name", by = "asc")
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.