← Back to team overview

dhis2-devs team mailing list archive

Re: Adding a dataset to an OrgUnit using the Web API (2.19)

 

Hey Jose,

This has been made quite a bit easier (since a while ago)

If you're just looking to add it to the collection
https://www.dhis2.org/doc/snapshot/en/developer/html/dhis2_developer_manual_full.html#d5094e731

So a POST request to
http://localhost:8080/dhis/api/organisationUnits/Oe3de1oAjGV/dataSets/Paf2o4Yx79Z
should do it :)

For removing you can just simply send a DELETE request to the same url

Regards,

Mark

On Tue, Sep 15, 2015 at 1:09 PM, Jose Garcia Muñoz <josemp10@xxxxxxxxx>
wrote:

>
> Hi Morten,
>
> I am trying to add a dataset to one org. unit using the Web API. So far, I
> am using the following API call:
>
> curl -X PATCH -d @c:\dataset.json -H "Content-Type: application/json" -u
> myuser:mypass
> http://localhost:8080/dhis/api/organisationUnits/Oe3de1oAjGV/dataSets
>
> The payload is:
>
> {"dataSets":[
> {
> "id": "Paf2o4Yx79Z",
> "created": "2015-04-23T10:16:44.809+0000",
> "name": "Vaccination Staff 3",
> "lastUpdated": "2015-09-15T09:58:06.990+0000",
> "code": "DS_VST_3",
> "href": "http://localhost:8080/dhis/api/dataSets/Paf2o4Yx79Z";
> }
> ]}
>
> I get a succesful message:
>
>
> {"status":"SUCCESS","importCount":{"imported":0,"updated":1,"ignored":0,"deleted":0},"type":"OrganisationUnit","lastImported":"Oe3de1oAjGV"}
>
> But nothing really happens.
>
> Any ideas? I am using the 2.19 version
>
> Thanks
> Jose
>
>
> _______________________________________________
> 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