← Back to team overview

dhis2-devs team mailing list archive

Fwd: Getting dataStore from dhis server

 

Hi devs,

Could you please respond to this?

Thanks,
Knut

---------- Forwarded message ----------
From: <magnuswmolaug@xxxxxxxxx>
Date: Mon, Nov 14, 2016 at 11:06 AM
Subject: Getting dataStore from dhis server
To: "knutst@xxxxxxxxxx" <knutst@xxxxxxxxxx>



Whenever we try to get a json object containing all the dataStore items, it
returns an empty object.



This is the code which is run at pageload.




loadObjectList(): *void *{


console.log("BBBB" + *this*.appService.getNamespaces());



}





This method in the app.component.ts file references the getNamespaces
function in the app.service.ts file






*private *serverUrl = 'https://play.dhis2.org/test/api/dataStore';

*private *headers = *new *Headers({'Content-Type': 'application/json'});




getNamespaces(): *any*{




*var *AAAA;
AAAA = *this*.http.get(*this*.serverUrl, {headers: *this*.headers})
    .map(res => res.json());
console.log("AAAA: " + AAAA.toString());
*return *AAAA;



}



This method tries to contact the dhis2.org/test server to get the dataStore
object.

I know that it exist, as the url ‘https://play.dhis2.org/test/api/dataStore’;
gives

["METADATASTORE","social-media-video"]



This tells me that I should at least get something, but I don’t.



I also tried to add my client to the CORS whitelist, and tried different
types of header, but nothing works.



I constantly get the response

app.service.ts:91                           AAAA: [object Object]

app.component.ts:195                 BBBB[object Object]



Hope you have an answer for this



Regards, Magnus W. Molaug



-- 
Cheers,
Knut Staring

Follow ups