You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cloudstack.apache.org by Marc-Aurèle Brothier <ma...@exoscale.ch> on 2018/04/23 13:34:41 UTC

Default API response type: XML -> JSON

Hi everyone,

I thought it would be good to move from XML to JSON by default in the
response of the API if no response type is sent to the server along with
the request. I'm wondering that's the opinion of people on the mailing list.

Moreover, if anyone knows a tool working with the API in XML can you list
them, so I could check the code and see if the change can be done without
breaking it.

PR to change default response type: (
https://github.com/apache/cloudstack/pull/2593).
If this change would cause more trouble, or is not needed in your opinion,
I don't mind to close the PR.

Kind regards,
Marc-Aurèle

Re: Default API response type: XML -> JSON

Posted by Rene Moser <ma...@renemoser.net>.
I am +1 but with a versioned API (v2) because this would break most
likely many API implementations.

René

On 04/23/2018 03:34 PM, Marc-Aurèle Brothier wrote:
> Hi everyone,
> 
> I thought it would be good to move from XML to JSON by default in the
> response of the API if no response type is sent to the server along with
> the request. I'm wondering that's the opinion of people on the mailing list.
> 
> Moreover, if anyone knows a tool working with the API in XML can you list
> them, so I could check the code and see if the change can be done without
> breaking it.
> 
> PR to change default response type: (
> https://github.com/apache/cloudstack/pull/2593).
> If this change would cause more trouble, or is not needed in your opinion,
> I don't mind to close the PR.
> 
> Kind regards,
> Marc-Aurèle
> 

Re: Default API response type: XML -> JSON

Posted by Ron Wheeler <rw...@artifact-software.com>.
The time would be better spent on fixing the docs.

It is time to turn Cloudstack into a production quality product with 
documentation that actually reflects the quality of the design and 
functionality.

At the moment you have 2 people willing to work on the docs waiting for 
a committer to decide that professional documentation matters.

This proposal seems to make the product more complicated with no 
substantial benefit.
Parsing XML is a well-known technology and switching to JSON does not 
seem to reduce the code required or reduce the complexity of the code.

If there is a desire to me "more modern", fix the documentation.


On 24/04/2018 6:14 AM, Marc-Aurèle Brothier wrote:
> @rafael - I think it's overkill to have this as a configuration option. We
> should have one default response type, or maybe not have a default one and
> enforce the use of the response type the client is willing to receive.
>
> On Mon, Apr 23, 2018 at 3:39 PM, Rafael Weingärtner <
> rafaelweingartner@gmail.com> wrote:
>
>> I do think it is an interesting proposal. I have been thinking, and what if
>> we do something different; what about a global parameter where the root
>> admin can define the default serialization mechanism (XML, JSON, RDF,
>> others...)? The default value could be XML to maintain backward
>> compatibility. Then, it is up to the root admin to define this behavior.
>>
>>
>> On Mon, Apr 23, 2018 at 10:34 AM, Marc-Aurèle Brothier <ma...@exoscale.ch>
>> wrote:
>>
>>> Hi everyone,
>>>
>>> I thought it would be good to move from XML to JSON by default in the
>>> response of the API if no response type is sent to the server along with
>>> the request. I'm wondering that's the opinion of people on the mailing
>>> list.
>>>
>>> Moreover, if anyone knows a tool working with the API in XML can you list
>>> them, so I could check the code and see if the change can be done without
>>> breaking it.
>>>
>>> PR to change default response type: (
>>> https://github.com/apache/cloudstack/pull/2593).
>>> If this change would cause more trouble, or is not needed in your
>> opinion,
>>> I don't mind to close the PR.
>>>
>>> Kind regards,
>>> Marc-Aurèle
>>>
>>
>>
>> --
>> Rafael Weingärtner
>>

-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


Re: Default API response type: XML -> JSON

Posted by Rohit Yadav <ro...@shapeblue.com>.
This can possibly fail some environments, but it depends on feedback from users.

One option is to introduce global settings, (but we've got many of those) such that it's set to XML set in ConfigKey, but when a new env is installed (as part of server xml/sql) we set it to JSON.


Another option is, do a survey, leave it open for few months and based on the feedback decide to accept the PR.


- Rohit

<https://cloudstack.apache.org>



________________________________
From: Rafael Weingärtner <ra...@gmail.com>
Sent: Tuesday, April 24, 2018 4:05:30 PM
To: users
Cc: dev
Subject: Re: Default API response type: XML -> JSON

No problem Marc, but I still do not think that having a parameter is an
overkill. My view is that if there is a decision to be made (regarding the
default response type for requests), if we (as developers) take this
decision (hardcode it), why not externalize it? I do not see as overkill,
it is a matter of having a flexible tool.

I do not think that forcing to have a response type would be a good thing
now. It would break requests that do not have it.


On Tue, Apr 24, 2018 at 7:14 AM, Marc-Aurèle Brothier <ma...@exoscale.ch>
wrote:

> @rafael - I think it's overkill to have this as a configuration option. We
> should have one default response type, or maybe not have a default one and
> enforce the use of the response type the client is willing to receive.
>
> On Mon, Apr 23, 2018 at 3:39 PM, Rafael Weingärtner <
> rafaelweingartner@gmail.com> wrote:
>
> > I do think it is an interesting proposal. I have been thinking, and what
> if
> > we do something different; what about a global parameter where the root
> > admin can define the default serialization mechanism (XML, JSON, RDF,
> > others...)? The default value could be XML to maintain backward
> > compatibility. Then, it is up to the root admin to define this behavior.
> >
> >
> > On Mon, Apr 23, 2018 at 10:34 AM, Marc-Aurèle Brothier <
> marco@exoscale.ch>
> > wrote:
> >
> > > Hi everyone,
> > >
> > > I thought it would be good to move from XML to JSON by default in the
> > > response of the API if no response type is sent to the server along
> with
> > > the request. I'm wondering that's the opinion of people on the mailing
> > > list.
> > >
> > > Moreover, if anyone knows a tool working with the API in XML can you
> list
> > > them, so I could check the code and see if the change can be done
> without
> > > breaking it.
> > >
> > > PR to change default response type: (
> > > https://github.com/apache/cloudstack/pull/2593).
> > > If this change would cause more trouble, or is not needed in your
> > opinion,
> > > I don't mind to close the PR.
> > >
> > > Kind regards,
> > > Marc-Aurèle
> > >
> >
> >
> >
> > --
> > Rafael Weingärtner
> >
>



--
Rafael Weingärtner

rohit.yadav@shapeblue.com 
www.shapeblue.com
53 Chandos Place, Covent Garden, London  WC2N 4HSUK
@shapeblue
  
 


Re: Default API response type: XML -> JSON

Posted by Rohit Yadav <ro...@shapeblue.com>.
This can possibly fail some environments, but it depends on feedback from users.

One option is to introduce global settings, (but we've got many of those) such that it's set to XML set in ConfigKey, but when a new env is installed (as part of server xml/sql) we set it to JSON.


Another option is, do a survey, leave it open for few months and based on the feedback decide to accept the PR.


- Rohit

<https://cloudstack.apache.org>



________________________________
From: Rafael Weingärtner <ra...@gmail.com>
Sent: Tuesday, April 24, 2018 4:05:30 PM
To: users
Cc: dev
Subject: Re: Default API response type: XML -> JSON

No problem Marc, but I still do not think that having a parameter is an
overkill. My view is that if there is a decision to be made (regarding the
default response type for requests), if we (as developers) take this
decision (hardcode it), why not externalize it? I do not see as overkill,
it is a matter of having a flexible tool.

I do not think that forcing to have a response type would be a good thing
now. It would break requests that do not have it.


On Tue, Apr 24, 2018 at 7:14 AM, Marc-Aurèle Brothier <ma...@exoscale.ch>
wrote:

> @rafael - I think it's overkill to have this as a configuration option. We
> should have one default response type, or maybe not have a default one and
> enforce the use of the response type the client is willing to receive.
>
> On Mon, Apr 23, 2018 at 3:39 PM, Rafael Weingärtner <
> rafaelweingartner@gmail.com> wrote:
>
> > I do think it is an interesting proposal. I have been thinking, and what
> if
> > we do something different; what about a global parameter where the root
> > admin can define the default serialization mechanism (XML, JSON, RDF,
> > others...)? The default value could be XML to maintain backward
> > compatibility. Then, it is up to the root admin to define this behavior.
> >
> >
> > On Mon, Apr 23, 2018 at 10:34 AM, Marc-Aurèle Brothier <
> marco@exoscale.ch>
> > wrote:
> >
> > > Hi everyone,
> > >
> > > I thought it would be good to move from XML to JSON by default in the
> > > response of the API if no response type is sent to the server along
> with
> > > the request. I'm wondering that's the opinion of people on the mailing
> > > list.
> > >
> > > Moreover, if anyone knows a tool working with the API in XML can you
> list
> > > them, so I could check the code and see if the change can be done
> without
> > > breaking it.
> > >
> > > PR to change default response type: (
> > > https://github.com/apache/cloudstack/pull/2593).
> > > If this change would cause more trouble, or is not needed in your
> > opinion,
> > > I don't mind to close the PR.
> > >
> > > Kind regards,
> > > Marc-Aurèle
> > >
> >
> >
> >
> > --
> > Rafael Weingärtner
> >
>



--
Rafael Weingärtner

rohit.yadav@shapeblue.com 
www.shapeblue.com
53 Chandos Place, Covent Garden, London  WC2N 4HSUK
@shapeblue
  
 


Re: Default API response type: XML -> JSON

Posted by Rafael Weingärtner <ra...@gmail.com>.
No problem Marc, but I still do not think that having a parameter is an
overkill. My view is that if there is a decision to be made (regarding the
default response type for requests), if we (as developers) take this
decision (hardcode it), why not externalize it? I do not see as overkill,
it is a matter of having a flexible tool.

I do not think that forcing to have a response type would be a good thing
now. It would break requests that do not have it.


On Tue, Apr 24, 2018 at 7:14 AM, Marc-Aurèle Brothier <ma...@exoscale.ch>
wrote:

> @rafael - I think it's overkill to have this as a configuration option. We
> should have one default response type, or maybe not have a default one and
> enforce the use of the response type the client is willing to receive.
>
> On Mon, Apr 23, 2018 at 3:39 PM, Rafael Weingärtner <
> rafaelweingartner@gmail.com> wrote:
>
> > I do think it is an interesting proposal. I have been thinking, and what
> if
> > we do something different; what about a global parameter where the root
> > admin can define the default serialization mechanism (XML, JSON, RDF,
> > others...)? The default value could be XML to maintain backward
> > compatibility. Then, it is up to the root admin to define this behavior.
> >
> >
> > On Mon, Apr 23, 2018 at 10:34 AM, Marc-Aurèle Brothier <
> marco@exoscale.ch>
> > wrote:
> >
> > > Hi everyone,
> > >
> > > I thought it would be good to move from XML to JSON by default in the
> > > response of the API if no response type is sent to the server along
> with
> > > the request. I'm wondering that's the opinion of people on the mailing
> > > list.
> > >
> > > Moreover, if anyone knows a tool working with the API in XML can you
> list
> > > them, so I could check the code and see if the change can be done
> without
> > > breaking it.
> > >
> > > PR to change default response type: (
> > > https://github.com/apache/cloudstack/pull/2593).
> > > If this change would cause more trouble, or is not needed in your
> > opinion,
> > > I don't mind to close the PR.
> > >
> > > Kind regards,
> > > Marc-Aurèle
> > >
> >
> >
> >
> > --
> > Rafael Weingärtner
> >
>



-- 
Rafael Weingärtner

Re: Default API response type: XML -> JSON

Posted by Ron Wheeler <rw...@artifact-software.com>.
The time would be better spent on fixing the docs.

It is time to turn Cloudstack into a production quality product with 
documentation that actually reflects the quality of the design and 
functionality.

At the moment you have 2 people willing to work on the docs waiting for 
a committer to decide that professional documentation matters.

This proposal seems to make the product more complicated with no 
substantial benefit.
Parsing XML is a well-known technology and switching to JSON does not 
seem to reduce the code required or reduce the complexity of the code.

If there is a desire to me "more modern", fix the documentation.


On 24/04/2018 6:14 AM, Marc-Aurèle Brothier wrote:
> @rafael - I think it's overkill to have this as a configuration option. We
> should have one default response type, or maybe not have a default one and
> enforce the use of the response type the client is willing to receive.
>
> On Mon, Apr 23, 2018 at 3:39 PM, Rafael Weingärtner <
> rafaelweingartner@gmail.com> wrote:
>
>> I do think it is an interesting proposal. I have been thinking, and what if
>> we do something different; what about a global parameter where the root
>> admin can define the default serialization mechanism (XML, JSON, RDF,
>> others...)? The default value could be XML to maintain backward
>> compatibility. Then, it is up to the root admin to define this behavior.
>>
>>
>> On Mon, Apr 23, 2018 at 10:34 AM, Marc-Aurèle Brothier <ma...@exoscale.ch>
>> wrote:
>>
>>> Hi everyone,
>>>
>>> I thought it would be good to move from XML to JSON by default in the
>>> response of the API if no response type is sent to the server along with
>>> the request. I'm wondering that's the opinion of people on the mailing
>>> list.
>>>
>>> Moreover, if anyone knows a tool working with the API in XML can you list
>>> them, so I could check the code and see if the change can be done without
>>> breaking it.
>>>
>>> PR to change default response type: (
>>> https://github.com/apache/cloudstack/pull/2593).
>>> If this change would cause more trouble, or is not needed in your
>> opinion,
>>> I don't mind to close the PR.
>>>
>>> Kind regards,
>>> Marc-Aurèle
>>>
>>
>>
>> --
>> Rafael Weingärtner
>>

-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


Re: Default API response type: XML -> JSON

Posted by Rafael Weingärtner <ra...@gmail.com>.
No problem Marc, but I still do not think that having a parameter is an
overkill. My view is that if there is a decision to be made (regarding the
default response type for requests), if we (as developers) take this
decision (hardcode it), why not externalize it? I do not see as overkill,
it is a matter of having a flexible tool.

I do not think that forcing to have a response type would be a good thing
now. It would break requests that do not have it.


On Tue, Apr 24, 2018 at 7:14 AM, Marc-Aurèle Brothier <ma...@exoscale.ch>
wrote:

> @rafael - I think it's overkill to have this as a configuration option. We
> should have one default response type, or maybe not have a default one and
> enforce the use of the response type the client is willing to receive.
>
> On Mon, Apr 23, 2018 at 3:39 PM, Rafael Weingärtner <
> rafaelweingartner@gmail.com> wrote:
>
> > I do think it is an interesting proposal. I have been thinking, and what
> if
> > we do something different; what about a global parameter where the root
> > admin can define the default serialization mechanism (XML, JSON, RDF,
> > others...)? The default value could be XML to maintain backward
> > compatibility. Then, it is up to the root admin to define this behavior.
> >
> >
> > On Mon, Apr 23, 2018 at 10:34 AM, Marc-Aurèle Brothier <
> marco@exoscale.ch>
> > wrote:
> >
> > > Hi everyone,
> > >
> > > I thought it would be good to move from XML to JSON by default in the
> > > response of the API if no response type is sent to the server along
> with
> > > the request. I'm wondering that's the opinion of people on the mailing
> > > list.
> > >
> > > Moreover, if anyone knows a tool working with the API in XML can you
> list
> > > them, so I could check the code and see if the change can be done
> without
> > > breaking it.
> > >
> > > PR to change default response type: (
> > > https://github.com/apache/cloudstack/pull/2593).
> > > If this change would cause more trouble, or is not needed in your
> > opinion,
> > > I don't mind to close the PR.
> > >
> > > Kind regards,
> > > Marc-Aurèle
> > >
> >
> >
> >
> > --
> > Rafael Weingärtner
> >
>



-- 
Rafael Weingärtner

Re: Default API response type: XML -> JSON

Posted by Marc-Aurèle Brothier <ma...@exoscale.ch>.
@rafael - I think it's overkill to have this as a configuration option. We
should have one default response type, or maybe not have a default one and
enforce the use of the response type the client is willing to receive.

On Mon, Apr 23, 2018 at 3:39 PM, Rafael Weingärtner <
rafaelweingartner@gmail.com> wrote:

> I do think it is an interesting proposal. I have been thinking, and what if
> we do something different; what about a global parameter where the root
> admin can define the default serialization mechanism (XML, JSON, RDF,
> others...)? The default value could be XML to maintain backward
> compatibility. Then, it is up to the root admin to define this behavior.
>
>
> On Mon, Apr 23, 2018 at 10:34 AM, Marc-Aurèle Brothier <ma...@exoscale.ch>
> wrote:
>
> > Hi everyone,
> >
> > I thought it would be good to move from XML to JSON by default in the
> > response of the API if no response type is sent to the server along with
> > the request. I'm wondering that's the opinion of people on the mailing
> > list.
> >
> > Moreover, if anyone knows a tool working with the API in XML can you list
> > them, so I could check the code and see if the change can be done without
> > breaking it.
> >
> > PR to change default response type: (
> > https://github.com/apache/cloudstack/pull/2593).
> > If this change would cause more trouble, or is not needed in your
> opinion,
> > I don't mind to close the PR.
> >
> > Kind regards,
> > Marc-Aurèle
> >
>
>
>
> --
> Rafael Weingärtner
>

Re: Default API response type: XML -> JSON

Posted by Marc-Aurèle Brothier <ma...@exoscale.ch>.
@rafael - I think it's overkill to have this as a configuration option. We
should have one default response type, or maybe not have a default one and
enforce the use of the response type the client is willing to receive.

On Mon, Apr 23, 2018 at 3:39 PM, Rafael Weingärtner <
rafaelweingartner@gmail.com> wrote:

> I do think it is an interesting proposal. I have been thinking, and what if
> we do something different; what about a global parameter where the root
> admin can define the default serialization mechanism (XML, JSON, RDF,
> others...)? The default value could be XML to maintain backward
> compatibility. Then, it is up to the root admin to define this behavior.
>
>
> On Mon, Apr 23, 2018 at 10:34 AM, Marc-Aurèle Brothier <ma...@exoscale.ch>
> wrote:
>
> > Hi everyone,
> >
> > I thought it would be good to move from XML to JSON by default in the
> > response of the API if no response type is sent to the server along with
> > the request. I'm wondering that's the opinion of people on the mailing
> > list.
> >
> > Moreover, if anyone knows a tool working with the API in XML can you list
> > them, so I could check the code and see if the change can be done without
> > breaking it.
> >
> > PR to change default response type: (
> > https://github.com/apache/cloudstack/pull/2593).
> > If this change would cause more trouble, or is not needed in your
> opinion,
> > I don't mind to close the PR.
> >
> > Kind regards,
> > Marc-Aurèle
> >
>
>
>
> --
> Rafael Weingärtner
>

Re: Default API response type: XML -> JSON

Posted by Rafael Weingärtner <ra...@gmail.com>.
I do think it is an interesting proposal. I have been thinking, and what if
we do something different; what about a global parameter where the root
admin can define the default serialization mechanism (XML, JSON, RDF,
others...)? The default value could be XML to maintain backward
compatibility. Then, it is up to the root admin to define this behavior.


On Mon, Apr 23, 2018 at 10:34 AM, Marc-Aurèle Brothier <ma...@exoscale.ch>
wrote:

> Hi everyone,
>
> I thought it would be good to move from XML to JSON by default in the
> response of the API if no response type is sent to the server along with
> the request. I'm wondering that's the opinion of people on the mailing
> list.
>
> Moreover, if anyone knows a tool working with the API in XML can you list
> them, so I could check the code and see if the change can be done without
> breaking it.
>
> PR to change default response type: (
> https://github.com/apache/cloudstack/pull/2593).
> If this change would cause more trouble, or is not needed in your opinion,
> I don't mind to close the PR.
>
> Kind regards,
> Marc-Aurèle
>



-- 
Rafael Weingärtner

Re: Default API response type: XML -> JSON

Posted by Martin Emrich <ma...@empolis.com>.
Hi!


Am 24.04.18 um 12:12 schrieb Marc-Aurèle Brothier:
> Hi Martin,
>
> The response format does not come from the "accept" header but from the
> request parameter "response", see the documentation:
> http://docs.cloudstack.apache.org/en/latest/dev.html#response-formats-xml-and-json.
> So your code works with the default mode. Can you quickly add
> "response=xml" to all your queries?
>
Yeah, that should be easy.... I might even switch to JSON, as I always 
get a mysterious itch when working with XML :-P

But good to know that XML won't go away soon, so the transition can wait 
for when I have some time to take care of it.

Thanks,

Martin

Re: Default API response type: XML -> JSON

Posted by Marc-Aurèle Brothier <ma...@exoscale.ch>.
Hi Martin,

The response format does not come from the "accept" header but from the
request parameter "response", see the documentation:
http://docs.cloudstack.apache.org/en/latest/dev.html#response-formats-xml-and-json.
So your code works with the default mode. Can you quickly add
"response=xml" to all your queries?

Cheers
Marc-Aurèle

On Tue, Apr 24, 2018 at 11:27 AM, Martin Emrich <ma...@empolis.com>
wrote:

> Hi!
>
> Am 23.04.18 um 15:34 schrieb Marc-Aurèle Brothier:
>
>> Hi everyone,
>>
>> I thought it would be good to move from XML to JSON by default in the
>> response of the API if no response type is sent to the server along with
>> the request. I'm wondering that's the opinion of people on the mailing
>> list.
>>
>> Would it still respond with XML as before if the requests contains an
> "Accept: text/xml" header?
> Otherwise it would break stuff for me...
>
> Cheers,
>
> Martin
>

Re: Default API response type: XML -> JSON

Posted by Martin Emrich <ma...@empolis.com>.
Hi!

Am 23.04.18 um 15:34 schrieb Marc-Aurèle Brothier:
> Hi everyone,
>
> I thought it would be good to move from XML to JSON by default in the
> response of the API if no response type is sent to the server along with
> the request. I'm wondering that's the opinion of people on the mailing list.
>
Would it still respond with XML as before if the requests contains an 
"Accept: text/xml" header?
Otherwise it would break stuff for me...

Cheers,

Martin

Re: Default API response type: XML -> JSON

Posted by Rafael Weingärtner <ra...@gmail.com>.
I do think it is an interesting proposal. I have been thinking, and what if
we do something different; what about a global parameter where the root
admin can define the default serialization mechanism (XML, JSON, RDF,
others...)? The default value could be XML to maintain backward
compatibility. Then, it is up to the root admin to define this behavior.


On Mon, Apr 23, 2018 at 10:34 AM, Marc-Aurèle Brothier <ma...@exoscale.ch>
wrote:

> Hi everyone,
>
> I thought it would be good to move from XML to JSON by default in the
> response of the API if no response type is sent to the server along with
> the request. I'm wondering that's the opinion of people on the mailing
> list.
>
> Moreover, if anyone knows a tool working with the API in XML can you list
> them, so I could check the code and see if the change can be done without
> breaking it.
>
> PR to change default response type: (
> https://github.com/apache/cloudstack/pull/2593).
> If this change would cause more trouble, or is not needed in your opinion,
> I don't mind to close the PR.
>
> Kind regards,
> Marc-Aurèle
>



-- 
Rafael Weingärtner