More API on Saturday :)
What is the manifest for?
{
"version": "0.0.1",
"name": "tech-session1",
"description": "The minimalist tech session 1 app!",
"icons": {
"48": "tech-session1.gif"
},
"developer": {
"url": "",
"name": "Mark"
},
"launch_path": "index.html",
"default_locale": "en",
"activities": {
"dhis": {
"href": "*"
}
}
}
{
"activities":{
"dhis":{
"href":"https://apps.dhis2.org/demo"
}
}
Server modifies the special property
{
"activities":{
"dhis":{
"href": "*"
}
}
fetch('../manifest.webapp', {credentials: 'same-origin'})
.then(function (response) { return response.json(); })
.then(function (manifest) {
var baseUrl = manifest.activities.dhis.href;
var apiUrl = [baseUrl + 'api'].join('/');
//Start your app here
//Add the baseUrl to your app (Load any core assets if required)
console.log(baseUrl);
})
.catch(function () {
console.log('Failed to load manifest');
});
Depends on what kind of app (or script)
Chrome apps for JSON Views with style
/api/schemas.json?fields=name,href
A lot of endpoints can be found through
npm install d2
import d2 from 'd2';
//Initialise the library (Returns a `Promise`)
d2({baseUrl: '/demo/api/'})
.then(function (d2) {
//D2 is initialised
});
Not really visible directly but used under the hood to keep track of model state, properties, validations and more
Save();
Validate();
List
d2.models.user.list();
d2.models.dataElement.get(<uid>);
d2.models.user.filter().on(<property>).like(<value>)
d2.models.indicator.filter().on(<property>).equals(<value>)