【发布时间】:2015-01-23 03:55:28
【问题描述】:
我在互联网上研究了关于 url 模式中的名词而不是动词的 restful API,但现在我看到多个链接在 URL 中使用动词。
这是一个例子。
- POST /v1/payments/authorization/
/capture - POST /v1/payments/authorization/
/void - POST /v1/payments/authorization/
/reauthorize
这是 Paypal api。 PayPal API
在 HTATEOAS 页面上的维基百科上,他们也举了一个例子;
<?xml version="1.0"?>
<account>
<account_number>12345</account_number>
<balance currency="usd">100.00</balance>
<link rel="deposit" href="/account/12345/deposit" />
<link rel="withdraw" href="/account/12345/withdraw" />
<link rel="transfer" href="/account/12345/transfer" />
<link rel="close" href="/account/12345/close" />
</account>
链接:维基HATEOAS
谁能帮我弄清楚这一点?为什么 'capture'、'void'、'deposit'、'withdraw'、'close' 在 URI 中,因为它们都是动词而不是名词?
或者在rest-full apis url中使用这些词可以吗?
【问题讨论】:
标签: rest restful-url