dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37656
Re: API - Assign DataElements to ProgramStage
Hi Alan,
did this work out? Let us know if you still need help.
regards,
Lars
On Fri, May 22, 2015 at 10:18 PM, Alan Hill <ahill@xxxxxxxxxx> wrote:
> Hi Morten
>
> I think I tried this at some stage but will give it another go.
>
> Many thanks for your reply.
>
> Alan
>
>
>
> On Fri, May 22, 2015 at 4:00 AM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
> wrote:
>
>> Hi again
>>
>> This doesn't work, programStageDataElements and dataElements are not the
>> same. You need to first create a programStageDataElement with the proper
>> dataElement, then connect it to the programStage.
>>
>> Have a look at /api/programStageDataElements
>>
>> --
>> Morten
>>
>> On Fri, May 22, 2015 at 12:25 PM, Lorill Crees <lcrees@xxxxxxxxxx> wrote:
>>
>>> Hi Morten,
>>>
>>> Yes it is:
>>> /api/programStages/<Program Stage ID>/programStageDataElements/<Data
>>> Element ID to add>
>>>
>>> Thanks,
>>>
>>> Lorill
>>>
>>> On Thu, May 21, 2015 at 9:51 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
>>> wrote:
>>>
>>>> Hi
>>>>
>>>> The ID you are using, is it data element ID?
>>>>
>>>> --
>>>> Morten
>>>>
>>>> On Tue, May 19, 2015 at 11:22 PM, Lorill Crees <lcrees@xxxxxxxxxx>
>>>> wrote:
>>>>
>>>>> We have also tried a POST to this to add each one individually:
>>>>>
>>>>> /api/programStages/<ID>/programStageDataElements/<ID to add>
>>>>>
>>>>> but get this error:
>>>>>
>>>>> "Collection programStageDataElements does not have an item with ID:
>>>>> xxx"
>>>>>
>>>>> From the example below it would be:
>>>>>
>>>>> /api/programStages/Ge9BWs3Bin2/programStageDataElements/auYAWubqi2C
>>>>>
>>>>> Any thoughts on how we can achieve this?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Lorill
>>>>>
>>>>> On Tue, May 12, 2015 at 6:56 PM, Alan Hill <ahill@xxxxxxxxxx> wrote:
>>>>>
>>>>>> 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
>>>>>>
>>>>>> _______________________________________________
>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>>> More help : https://help.launchpad.net/ListHelp
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>> More help : https://help.launchpad.net/ListHelp
>>>>>
>>>>>
>>>>
>>>
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
>
Follow ups
References