new destroy(resourceType, path, dataopt, optionsopt, callbackopt) → {Operation}
Delete a record. A generic helper function to delete an object
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
resourceType |
string | The type of resource to be deleted. E.g. `trackedEntityInstances`, `organisationUnits`, etc. | |
path |
string | Can be an `id` of an `object` or `path` to the `nested object` to `delete`. | |
data |
Object |
<optional> |
Optional. This is useful when you want to remove multiple objects from a collection in one request. You can send `data` as, for example, `{"identifiableObjects": [{"id": "IDA"}, {"id": "IDB"}, {"id": "IDC"}]}`. See more on DHIS2 API docs |
options |
Object |
<optional> |
Optional `options` for `del` operation including params e.g. `{preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}`. Run `discover` or see DHIS2 documentation. Defaults to `{operationName: 'delete', apiVersion: state.configuration.apiVersion, responseType: 'json'}` |
callback |
function |
<optional> |
Optional callback to handle the response |
- Source:
Returns:
- Type
- Operation
Example
destroy('trackedEntityInstances', 'LcRd6Nyaq7T');