You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Prasanna Santhanam <ts...@apache.org> on 2013/04/24 10:38:47 UTC

Exposing APIs that carry POST data

Vijay added the ability to send userdata as POST for the
deployVirtualMachine API in review [1]. What I'd like to address here
is how to expose this via ApiDiscovery so that clients like marvin,
cloudmonkey can autogenerate themselves to support APIs of this
kind. This also needs to be clearly specified in our API docs.

I'm guessing we'll have to put in additional annotations on our APIs
that support POST so that API discovery can print the methods
supported (GET/POST). Right now it's only the deployVMCmd (AFAIK). But
I expect this will need to be done for others soon.

I've included POST support for _every_ command in marvin but that's
just brute-force. To make it more intelligent I think we should apply
it to only apis that make sense as POST (causing side-effects). But
that needs to be exposed by the api endpoint.

Thoughts?

[1] https://reviews.apache.org/r/10294/

-- 
Prasanna.,

------------------------
Powered by BigRock.com


Re: Exposing APIs that carry POST data

Posted by Min Chen <mi...@citrix.com>.
REST based service is postponed, no active progress from mysids either.

Thanks
-min

On 4/25/13 1:10 AM, "Rohit Yadav" <bh...@apache.org> wrote:

>On Thu, Apr 25, 2013 at 10:59 AM, Prasanna Santhanam <ts...@apache.org>
>wrote:
>
>> On Wed, Apr 24, 2013 at 06:08:49AM -0400, Sebastien Goasguen wrote:
>> >
>> > On Apr 24, 2013, at 4:38 AM, Prasanna Santhanam <ts...@apache.org>
>>wrote:
>> >
>> > > Vijay added the ability to send userdata as POST for the
>> > > deployVirtualMachine API in review [1]. What I'd like to address
>>here
>> > > is how to expose this via ApiDiscovery so that clients like marvin,
>> > > cloudmonkey can autogenerate themselves to support APIs of this
>> > > kind. This also needs to be clearly specified in our API docs.
>> > >
>> > > I'm guessing we'll have to put in additional annotations on our APIs
>> > > that support POST so that API discovery can print the methods
>> > > supported (GET/POST). Right now it's only the deployVMCmd (AFAIK).
>>But
>> > > I expect this will need to be done for others soon.
>> > >
>> > > I've included POST support for _every_ command in marvin but that's
>> > > just brute-force. To make it more intelligent I think we should
>>apply
>> > > it to only apis that make sense as POST (causing side-effects). But
>> > > that needs to be exposed by the api endpoint.
>> > >
>> > > Thoughts?
>> >
>> > Prasanna, this seems to me like a bigger discussion as you say, we
>> > could see more api start having a POST.
>>
>> > Will we later see DELETE and PATCH?
>> >
>> > Could be that we are talking about making the API from RESTfull
>> > which would be a big undertaking.
>>
>> I think some work was already underway - Min/Rohit started working on
>> a complete REST based service. It is a significant change and I'll let
>> them speak about the scale of that change. In my case, I just want to
>> auto-generate marvin classes without having to hand edit anything.
>>
>
>Nothing from my side on REST based service.
>
>
>>
>> >
>> > I started a toy REST example for a talk:
>> > https://github.com/runseb/cloudstack-flask/blob/master/flasktest.py
>>
>
>+1 cool
>
>Cheers.
>
>
>> This is cool! Will check it out!
>>
>> >
>> > It would be a bit silly to create a REST wrapper on our API but might
>> give ideas...
>> >
>> > -Sebastien
>> >
>> > >
>> > > [1] https://reviews.apache.org/r/10294/
>> > >
>> > > --
>> > > Prasanna.,
>> > >
>> > > ------------------------
>> > > Powered by BigRock.com
>> > >
>>
>> --
>> Prasanna.,
>>
>> ------------------------
>> Powered by BigRock.com
>>
>>


Re: Exposing APIs that carry POST data

Posted by Rohit Yadav <bh...@apache.org>.
On Thu, Apr 25, 2013 at 10:59 AM, Prasanna Santhanam <ts...@apache.org> wrote:

> On Wed, Apr 24, 2013 at 06:08:49AM -0400, Sebastien Goasguen wrote:
> >
> > On Apr 24, 2013, at 4:38 AM, Prasanna Santhanam <ts...@apache.org> wrote:
> >
> > > Vijay added the ability to send userdata as POST for the
> > > deployVirtualMachine API in review [1]. What I'd like to address here
> > > is how to expose this via ApiDiscovery so that clients like marvin,
> > > cloudmonkey can autogenerate themselves to support APIs of this
> > > kind. This also needs to be clearly specified in our API docs.
> > >
> > > I'm guessing we'll have to put in additional annotations on our APIs
> > > that support POST so that API discovery can print the methods
> > > supported (GET/POST). Right now it's only the deployVMCmd (AFAIK). But
> > > I expect this will need to be done for others soon.
> > >
> > > I've included POST support for _every_ command in marvin but that's
> > > just brute-force. To make it more intelligent I think we should apply
> > > it to only apis that make sense as POST (causing side-effects). But
> > > that needs to be exposed by the api endpoint.
> > >
> > > Thoughts?
> >
> > Prasanna, this seems to me like a bigger discussion as you say, we
> > could see more api start having a POST.
>
> > Will we later see DELETE and PATCH?
> >
> > Could be that we are talking about making the API from RESTfull
> > which would be a big undertaking.
>
> I think some work was already underway - Min/Rohit started working on
> a complete REST based service. It is a significant change and I'll let
> them speak about the scale of that change. In my case, I just want to
> auto-generate marvin classes without having to hand edit anything.
>

Nothing from my side on REST based service.


>
> >
> > I started a toy REST example for a talk:
> > https://github.com/runseb/cloudstack-flask/blob/master/flasktest.py
>

+1 cool

Cheers.


> This is cool! Will check it out!
>
> >
> > It would be a bit silly to create a REST wrapper on our API but might
> give ideas...
> >
> > -Sebastien
> >
> > >
> > > [1] https://reviews.apache.org/r/10294/
> > >
> > > --
> > > Prasanna.,
> > >
> > > ------------------------
> > > Powered by BigRock.com
> > >
>
> --
> Prasanna.,
>
> ------------------------
> Powered by BigRock.com
>
>

Re: Exposing APIs that carry POST data

Posted by Prasanna Santhanam <ts...@apache.org>.
On Wed, Apr 24, 2013 at 06:08:49AM -0400, Sebastien Goasguen wrote:
> 
> On Apr 24, 2013, at 4:38 AM, Prasanna Santhanam <ts...@apache.org> wrote:
> 
> > Vijay added the ability to send userdata as POST for the
> > deployVirtualMachine API in review [1]. What I'd like to address here
> > is how to expose this via ApiDiscovery so that clients like marvin,
> > cloudmonkey can autogenerate themselves to support APIs of this
> > kind. This also needs to be clearly specified in our API docs.
> > 
> > I'm guessing we'll have to put in additional annotations on our APIs
> > that support POST so that API discovery can print the methods
> > supported (GET/POST). Right now it's only the deployVMCmd (AFAIK). But
> > I expect this will need to be done for others soon.
> > 
> > I've included POST support for _every_ command in marvin but that's
> > just brute-force. To make it more intelligent I think we should apply
> > it to only apis that make sense as POST (causing side-effects). But
> > that needs to be exposed by the api endpoint.
> > 
> > Thoughts?
> 
> Prasanna, this seems to me like a bigger discussion as you say, we
> could see more api start having a POST.

> Will we later see DELETE and PATCH?
> 
> Could be that we are talking about making the API from RESTfull
> which would be a big undertaking.

I think some work was already underway - Min/Rohit started working on
a complete REST based service. It is a significant change and I'll let
them speak about the scale of that change. In my case, I just want to
auto-generate marvin classes without having to hand edit anything.

> 
> I started a toy REST example for a talk:
> https://github.com/runseb/cloudstack-flask/blob/master/flasktest.py

This is cool! Will check it out!

> 
> It would be a bit silly to create a REST wrapper on our API but might give ideas...
> 
> -Sebastien
> 
> > 
> > [1] https://reviews.apache.org/r/10294/
> > 
> > -- 
> > Prasanna.,
> > 
> > ------------------------
> > Powered by BigRock.com
> > 

-- 
Prasanna.,

------------------------
Powered by BigRock.com


Re: Exposing APIs that carry POST data

Posted by Sebastien Goasguen <ru...@gmail.com>.
On Apr 24, 2013, at 4:38 AM, Prasanna Santhanam <ts...@apache.org> wrote:

> Vijay added the ability to send userdata as POST for the
> deployVirtualMachine API in review [1]. What I'd like to address here
> is how to expose this via ApiDiscovery so that clients like marvin,
> cloudmonkey can autogenerate themselves to support APIs of this
> kind. This also needs to be clearly specified in our API docs.
> 
> I'm guessing we'll have to put in additional annotations on our APIs
> that support POST so that API discovery can print the methods
> supported (GET/POST). Right now it's only the deployVMCmd (AFAIK). But
> I expect this will need to be done for others soon.
> 
> I've included POST support for _every_ command in marvin but that's
> just brute-force. To make it more intelligent I think we should apply
> it to only apis that make sense as POST (causing side-effects). But
> that needs to be exposed by the api endpoint.
> 
> Thoughts?

Prasanna, this seems to me like a bigger discussion as you say, we could see more api start having a POST.
Will we later see DELETE and PATCH…

Could be that we are talking about making the API from RESTfull which would be a big undertaking.

I started a toy REST example for a talk:
https://github.com/runseb/cloudstack-flask/blob/master/flasktest.py

It would be a bit silly to create a REST wrapper on our API but might give ideas...

-Sebastien

> 
> [1] https://reviews.apache.org/r/10294/
> 
> -- 
> Prasanna.,
> 
> ------------------------
> Powered by BigRock.com
> 


Re: Exposing APIs that carry POST data

Posted by Prasanna Santhanam <ts...@apache.org>.
On Wed, Apr 24, 2013 at 09:02:09AM -0700, Chiradeep Vittal wrote:
> CS has always had the ability to accept POST for any api.

Oh I don't know about that. Because it seems like Vijay has had to
drill down the HTTP Method into the API layer. Changes to the
BaseCmd.java indicate the method (GET/POST) that the request came
through and that is sent down to the manager classes to run custom
business logic - in Vijay's case it was the sizeof(userdata)

Perhaps doPost() has always been supported by the ApiServlet and
that's what you meant? I may be wrong - but if POST was always
supported we should have been able to send userdata without any
changes.

-- 
Prasanna.,

> 
> On 4/24/13 1:38 AM, "Prasanna Santhanam" <ts...@apache.org> wrote:
> 
> >Vijay added the ability to send userdata as POST for the
> >deployVirtualMachine API in review [1]. What I'd like to address here
> >is how to expose this via ApiDiscovery so that clients like marvin,
> >cloudmonkey can autogenerate themselves to support APIs of this
> >kind. This also needs to be clearly specified in our API docs.
> >
> >I'm guessing we'll have to put in additional annotations on our APIs
> >that support POST so that API discovery can print the methods
> >supported (GET/POST). Right now it's only the deployVMCmd (AFAIK). But
> >I expect this will need to be done for others soon.
> >
> >I've included POST support for _every_ command in marvin but that's
> >just brute-force. To make it more intelligent I think we should apply
> >it to only apis that make sense as POST (causing side-effects). But
> >that needs to be exposed by the api endpoint.
> >
> >Thoughts?
> >
> >[1] https://reviews.apache.org/r/10294/
> >
> >-- 
> >Prasanna.,
> >
> >------------------------
> >Powered by BigRock.com
> >


------------------------
Powered by BigRock.com


Re: Exposing APIs that carry POST data

Posted by Chiradeep Vittal <Ch...@citrix.com>.
CS has always had the ability to accept POST for any api.

On 4/24/13 1:38 AM, "Prasanna Santhanam" <ts...@apache.org> wrote:

>Vijay added the ability to send userdata as POST for the
>deployVirtualMachine API in review [1]. What I'd like to address here
>is how to expose this via ApiDiscovery so that clients like marvin,
>cloudmonkey can autogenerate themselves to support APIs of this
>kind. This also needs to be clearly specified in our API docs.
>
>I'm guessing we'll have to put in additional annotations on our APIs
>that support POST so that API discovery can print the methods
>supported (GET/POST). Right now it's only the deployVMCmd (AFAIK). But
>I expect this will need to be done for others soon.
>
>I've included POST support for _every_ command in marvin but that's
>just brute-force. To make it more intelligent I think we should apply
>it to only apis that make sense as POST (causing side-effects). But
>that needs to be exposed by the api endpoint.
>
>Thoughts?
>
>[1] https://reviews.apache.org/r/10294/
>
>-- 
>Prasanna.,
>
>------------------------
>Powered by BigRock.com
>