dhis2 / notes

:memo: Memos, proposals, agendas and meeting minutes
19 stars 8 forks source link

Bulk metadata sharing API #314

Closed vietnguyen closed 2 years ago

vietnguyen commented 2 years ago

Requirement

Endpoint

Parameters

Name Default Description
atomic true If this is set to true, then the batch function will stop and not updating any objects if there is an error. Otherwise, if this is false then the function will try to proceed with best effort mode.

Backend function

Validation

Response

Payload

[
    {
        "id": "fbfJHSPpUQD",
        "op": "replace",
        "path": "/sharing/users",
        "value": {
            "NOOF56dveaZ": {
                "access": "rw------",
                "id": "NOOF56dveaZ"
            },
            "Kh68cDMwZsg": {
                "access": "rw------",
                "id": "Kh68cDMwZsg"
            }
        }
    },
    {
        "id":"fbfJHAJpUQS",
        "op": "add",
        "path": "/sharing/users/NOOF56dveaZ",
        "value": {
            "access": "rw------",
            "id": "NOOF56dveaZ"
        }
    },
    {
        "id": "cYeuwXTCPkU",
        "op": "remove",
        "path": "/sharing/users/N3PZBUlN8vq"
    },
    {
        "id": "GOLswS44mh8",
        "op": "add",
        "path": "/sharing/userGroups",
        "value": {
            "NOOF56dveaZ": {
                "access": "rw------",
                "id": "NOOF56dveaZ"
            },
            "Kh68cDMwZsg": {
                "access": "rw------",
                "id": "Kh68cDMwZsg"
            }
        }
    }
]

Bonus

larshelge commented 2 years ago

Wonder if the naming (/dataElements/batch) could be made a bit more descriptive and specific, i.e. batch is quite generic. Perhaps instead use /dataElements/sharing. That way it is consistent with dataElements/{uid}/sharing, and being at dataElements level implies it applies to many objects.

jbee commented 2 years ago

We said we make it a https://github.com/dhis2/notes/discussions right? Does it exist? Can we link it here?

vietnguyen commented 2 years ago

moved here https://github.com/dhis2/notes/discussions/317