← Back to team overview

dhis2-users team mailing list archive

Re: API shifted from HTML to XML?

 

Hi Guys

I must say, seconding what Knut has pointed out, I'm a bit worried by this
development especially from a rapid app development perspective. I for one,
am totally reliant on the json Web-API resources and interact with them on
a day-to-day basis. So if accessing web-api *json* resources is becoming
increasingly harder, what's the alternative for app developers? I'm sorry
guys for being ridiculous, but please help me out?

Regards

Farai


On Mon, Jul 14, 2014 at 10:36 AM, Bob Jolliffe <bobjolliffe@xxxxxxxxx>
wrote:

> Much though I have to love json, this does seem to be a case where
> maintaining an xml stylesheet is the cleanest separation of form and
> content.
>
> What about adding an xml processing instruction to the xml like:
>
> <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="<some base url>/dxf2html.xsl"?><document>
>   ...</document>
>
>
> This will have no effect on consuming the xml normally (except for making
> it one line longer) but will allow a browser to render it nicely.
>
> Of course dxf2html.xsl would have to be maintained.  It could be provided
> by an app.  Or the whole url could be just a system setting.  Then if the
> setting exists the processing instruction is emitted, if not then its not.
>  Or there is a basic functionality which can be overridden by an app ...
>
>
> On 14 July 2014 05:19, Morten Olav Hansen <mortenoh@xxxxxxxxx> wrote:
>
>> Of course we could do that, but that would take away part of the
>> restfulness of the API. I don't think we should change the way our links
>> works, just because a plugin supports making http://* into real links. I
>> understand that it is a bit harder to browse the API right now, but that
>> should be fixed soon. We don't have to wait for 2.17 to be released for
>> this, it could easily live as an external app, it shouldn't take long to
>> develop something like that.
>>
>> --
>> Morten
>>
>>
>> On Mon, Jul 14, 2014 at 11:06 AM, Knut Staring <knutst@xxxxxxxxx> wrote:
>>
>>> So you can't just add .json to these links?
>>>
>>>
>>> On Mon, Jul 14, 2014 at 6:04 AM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
>>> wrote:
>>>
>>>> We do expose JSON as the default, if you send header "Accept: */*" that
>>>> would return a JSON result. Problem is that the browser is usually sending
>>>> something like "Accept: text/html, application/xml, ....." so since it has
>>>> no match for text/html, it will go to application/xml.
>>>>
>>>> We are hoping to provide an API browser app for 2.17.
>>>>
>>>> --
>>>> Morten
>>>>
>>>>
>>>> On Mon, Jul 14, 2014 at 7:25 AM, Knut Staring <knutst@xxxxxxxxx> wrote:
>>>>
>>>>> A shortcut to making an app would be if we exposed .json by default
>>>>> instead of XML:
>>>>>
>>>>> https://apps.dhis2.org/dev/api/resources.json has nicely clickable
>>>>> links if the user has something like JSONView installed:
>>>>>
>>>>> https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc
>>>>>
>>>>> Knut
>>>>>
>>>>>
>>>>> On Sun, Jul 13, 2014 at 8:18 PM, Lars Helge Øverland <
>>>>> larshelge@xxxxxxxxx> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> yes its intentional. The HTML templates were static and too much
>>>>>> hassle to keep in synch with the model.
>>>>>>
>>>>>> App idea: make an app that renders a nice, linked HTML-view for all
>>>>>> resources based on the json resources.
>>>>>>
>>>>>> Lars
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Sun, Jul 13, 2014 at 2:44 PM, Knut Staring <knutst@xxxxxxxxx>
>>>>>> wrote:
>>>>>>
>>>>>>> Or is there just a missing style file:
>>>>>>> This XML file does not appear to have any style information
>>>>>>> associated with it
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Jul 13, 2014 at 2:42 PM, Knut Staring <knutst@xxxxxxxxx>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>> When I browse the API in 2.16, I seem to get XM
>>>>>>>> https://apps.dhis2.org/dev/api/resources
>>>>>>>>
>>>>>>>> instead of HTML, like it was in 2.15
>>>>>>>> https://apps.dhis2.org/demo/api/resources
>>>>>>>>
>>>>>>>> Is this intentional?
>>>>>>>>
>>>>>>>> --
>>>>>>>> Knut Staring
>>>>>>>> Dept. of Informatics, University of Oslo
>>>>>>>> +4791880522
>>>>>>>> http://dhis2.org
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Knut Staring
>>>>>>> Dept. of Informatics, University of Oslo
>>>>>>> +4791880522
>>>>>>> http://dhis2.org
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mailing list: https://launchpad.net/~dhis2-users
>>>>>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>>>>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Knut Staring
>>>>> Dept. of Informatics, University of Oslo
>>>>> +4791880522
>>>>> http://dhis2.org
>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~dhis2-users
>>>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Knut Staring
>>> Dept. of Informatics, University of Oslo
>>> +4791880522
>>> http://dhis2.org
>>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Farai Mutero

Follow ups

References