Hi Mark,

The app I am developing is running with-in a DHIS2 context. Below is the
error from the console. I have also included the code fragment causing the
error.

[image: Inline images 1]

var data = {
                            "dashlets" : dashlets
                        }

                        $http.put('/api/dataStore/rbcdashboard/HIV', data, {
                            headers : {
                                'Content-Type' : 'application/json'
                            }
                        })
                        .success(function (data, status, headers) {
                            console.debug(data)
                        });
Thanks,

Michael

On 7 August 2016 at 10:50, Mark Polak <m...@dhis2.org> wrote:

> Hey Michael,
>
> Are you developing the app using CORS? If you're doing CORS requests you
> will need to include the header yes. If your app is running from within the
> dhis2 context (as in you installed it) you won't need to do so.
>
> Generally when the Authorization header is not send the API would 302 you
> to the login page, so perhaps something else is the matter. When POSTing to
> the dataStore api you need to POST to /api/dataStore/<namespace>/<key>
> If you could share a piece of the code where you do the request, perhaps i
> can give you some more detailed feedback. :)
>
>
> On Sun, Aug 7, 2016 at 11:18 AM, Michael Mwebaze <
> michael.mweb...@gmail.com> wrote:
>
>> Hi,
>>
>> I am developing a DHIS2 based app using AngularJS. The $http.get is
>> successful but I am getting 403 (Forbidden) with the POST and PUT when I
>> try to add a new item to the dataStore. Am I supposed to include
>> Authorization: Basic base64encode(username:password) in the header as
>> well? Is there an example I can follow for DHIS2 based apps?
>>
>> Thanks,
>>
>> Michael
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-d...@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Regards,
>
>
> Mark Polak
> Software developer, DHIS 2
> University of Oslo
> http://www.dhis2.org <https://www.dhis2.org/>
> m...@dhis2.org
>
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to