<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>As you said RESTful is not a standard but brings guidelines of
good practices. Which in turn doesn't preclude adding ideas, as
long as respecting RESTful approach. So we get from both sides.<br>
</p>
<p>Therefore a good schema structure adds to a de-facto standard,
once the practice is commonly used.</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 02/02/18 19:11, Duncan Thomas wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOyZ2aFXBnCML-QkN9LVVuWt4F__DZQNRaPS52nYapgqrCEziQ@mail.gmail.com">
<div dir="auto">So I guess my question here is why is being
RESTful good? Sure it's (very, very loosely) a standard, but
what are the actual advantages? Standards come and go, what we
want most of all is a good quality, easy to use API.
<div dir="auto"><br>
</div>
<div dir="auto">I'm not saying that going RESTful is wrong, but
I don't see much discussion about what the advantages are,
only about how close we are to implementing it.</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 1 Feb 2018 10:55 pm, "Ed Leafe" <<a
href="mailto:ed@leafe.com" moz-do-not-send="true">ed@leafe.com</a>>
wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">On Jan 18,
2018, at 4:07 AM, TommyLike Hu <<a
href="mailto:tommylikehu@gmail.com" moz-do-not-send="true">tommylikehu@gmail.com</a>>
wrote:<br>
<br>
> Recently We found an issue related to our OpenStack
action APIs. We usually expose our OpenStack APIs by
registering them to our API Gateway (for instance Kong [1]),
but it becomes very difficult when regarding to action APIs.
We can not register and control them seperately because them
all share the same request url which will be used as the
identity in the gateway service, not say rate limiting and
other advanced gateway features, take a look at the basic
resources in OpenStack<br>
<br>
We discussed your email at today’s API-SIG meeting [0]. This
is an area that is always contentious in the RESTful world.
Actions, tasks, and state changes are not actual resources,
and in a pure REST design they should never be part of the
URL. Instead, you should POST to the actual resource, with
the desired action in the body. So in your example:<br>
<br>
> URL:/volumes/{volume_id}/<wbr>action<br>
> BODY:{'extend':{}}<br>
<br>
the preferred way of achieving this is:<br>
<br>
URL: POST /volumes/{volume_id}<br>
BODY: {‘action’: ‘extend’, ‘params’: {}}<br>
<br>
The handler for the POST action should inspect the body, and
call the appropriate method.<br>
<br>
Having said that, we realize that a lot of OpenStack
services have adopted the more RPC-like approach that you’ve
outlined. So while we strongly recommend a standard RESTful
approach, if you have already released an RPC-like API, our
advice is:<br>
<br>
a) avoid having every possible verb in the URL. In other
words, don’t use:<br>
/volumes/{volume_id}/mount<br>
/volumes/{volume_id}/umount<br>
/volumes/{volume_id}/extend<br>
This moves you further into RPC-land, and will make updating
your API to a more RESTful design more difficult.<br>
<br>
b) choose a standard term for the item in the URL. In other
words, always use ‘action’ or ‘task’ or whatever else you
have adopted. Don’t mix terminology. Then pass the action to
perform, along with any parameters in the body. This will
make it easier to transition to a RESTful design by later
updating the handlers to first inspect the BODY instead of
relying upon the URL to determine what action to perform.<br>
<br>
You might also want to contact the Kong developers to see if
there is a way to work with a RESTful API design.<br>
<br>
-- Ed Leafe<br>
<br>
[0] <a
href="http://eavesdrop.openstack.org/meetings/api_sig/2018/api_sig.2018-02-01-16.02.log.html#l-28"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://eavesdrop.openstack.<wbr>org/meetings/api_sig/2018/api_<wbr>sig.2018-02-01-16.02.log.html#<wbr>l-28</a><br>
<br>
<br>
<br>
<br>
______________________________<wbr>______________________________<wbr>______________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a
href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe"
rel="noreferrer" target="_blank" moz-do-not-send="true">OpenStack-dev-request@lists.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
<a
href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
</blockquote>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: <a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev-request@lists.openstack.org?subject:unsubscribe">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a>
<a class="moz-txt-link-freetext" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">
</pre>
</body>
</html>