← Back to team overview

dhis2-devs team mailing list archive

API - Assign DataElements to ProgramStage

 

Is there any way to assign DataElements to ProgramStages through the API as
per the UI?

I've tried PUTing to /api/programStage/<ID> with programStageDataElements
set to a list of dataElement ids but without joy e.g.

{
    "id": "Ge9BWs3Bin2",
    "created": "2015-05-12T21:54:21.303+0000",
    "name": "NAME",
    "href": "http://localhost:8000/api/programStages/Ge9BWs3Bin2";,
    "lastUpdated": "2015-05-12T22:45:36.117+0000",
    "dataEntryType": "default",
    "reportDateDescription": "Survey Date",
    "blockEntryForm": false,
    "displayGenerateEventBox": true,
    "description": "Births Data",
    "externalAccess": false,
    "openAfterEnrollment": false,
    "captureCoordinates": false,
    "defaultTemplateMessage": "Dear {person-name}, please come to your
appointment on {program-stage-name} at {due-date}",
    "remindCompleted": false,
    "validCompleteOnly": false,
    "generatedByEnrollmentDate": false,
    "preGenerateUID": false,
    "autoGenerateEvent": true,
    "allowGenerateNextVisit": false,
    "repeatable": true,
    "minDaysFromStart": 0,
    "displayName": "DISPLAY NAME",
    "access": {
        "update": true,
        "externalize": false,
        "write": true,
        "delete": true,
        "read": true,
        "manage": false
    },
    "program": {
        "id": "RrU8oA7Ja0R",
        "name": "PROGRAM NAME",
        "created": "2015-05-12T21:54:20.954+0000",
        "lastUpdated": "2015-05-12T21:54:21.077+0000",
        "href": "http://localhost:8000/api/programs/RrU8oA7Ja0R";
    },
    "trackedEntityInstanceReminders": [],
    "programStageDataElements": [
        {
            "id": "auYAWubqi2C",
            "created": "2015-05-12T22:52:52.865+0000",
            "lastUpdated": "2015-05-12T22:52:52.866+0000",
            "href": "
http://localhost:8000/api/programStageDataElements/auYAWubqi2C";
        },
        {
            "id": "ouarmjjDK30",
            "created": "2015-05-12T22:52:52.871+0000",
            "lastUpdated": "2015-05-12T22:52:52.871+0000",
            "href": "
http://localhost:8000/api/programStageDataElements/ouarmjjDK30";
        },
        {
            "id": "HuAKbEkv8R9",
            "created": "2015-05-12T22:52:52.875+0000",
            "lastUpdated": "2015-05-12T22:52:52.875+0000",
            "href": "
http://localhost:8000/api/programStageDataElements/HuAKbEkv8R9";
        }
    ],
    "attributeValues": [],
    "userGroupAccesses": [],
    "programStageSections": []
}

Tells me it's been updated but nothing changes.

Any suggestions greatly appreciated.

Thanks

Follow ups