Charts ********* View chart for specific fields in a form or dataset. List of chart chart endpoints accessible to registered user ----------------------------------------------------------- .. raw:: html
    GET /api/v1/charts
Example ^^^^^^^^ :: curl -X GET https://api.ona.io/api/v1/charts Response ^^^^^^^^^ :: [{ "id": 4240, "id_string": "dhis2form", "url": "https://api.ona.io/api/v1/charts/4240", } ... Get a list of chart field endpoints for a specific form or dataset. ------------------------------------------------------------------- .. raw:: html
    GET /api/v1/charts/{formid}
Example ^^^^^^^ :: curl -X GET https://api.ona.io/api/v1/charts/4240 Response ^^^^^^^^^ :: { "id": 4240, "id_string": "dhis2form", "url": "https://api.ona.io/api/v1/charts/4240", "fields": { "uuid": "https://api.ona.io/api/v1/charts/4240?field_name=uuid", "num": "https://api.ona.io/api/v1/charts/4240?field_name=num", ... } } Get a chart for a specific field in a form -------------------------------------------- - ``field_name`` - a field name in the form - ``format`` - can be ``html`` or ``json`` .. raw:: html
    GET /api/v1/charts/{formid}.{format}?field_name=field_name
Example ^^^^^^^ :: curl -X GET https://api.ona.io/api/v1/charts/4240.html?field_name=age Response ^^^^^^^^ - ``html`` format response is a html, javascript and css to the chart - ``json`` format response is the ``JSON`` data that can be passed to a charting library Get a chart data for all fields in a form ------------------------------------------ The only field ommitted is instanceID since it is unique for every record. - ``fields`` - is a comma separated list of fields to be included in the response. If ``fields=all`` then all the fields of the form will be returned. .. raw:: html
    GET /api/v1/charts/{formid}?fields=all
    
Example ^^^^^^^ :: curl -X GET https://api.ona.io/api/v1/charts/4240?fields=all Response ^^^^^^^^^ - `json` format response is the `JSON` data for each field that can be passed to a charting library