Agent Wranglers

Resources and methods Required

Name resources as plural nouns

Address each kind of thing as a plural noun, and each single thing by its ID under it. Keep verbs out of paths.

How to do it

Use paths such as /orders and /orders/{orderId}. Nest only one level for things that belong to a parent, such as /orders/{orderId}/items. Use lowercase words joined by hyphens. When an action fits no method, model it as a sub-resource, such as POST /orders/{orderId}/cancellation.

Example

GET  /orders                       list orders
POST /orders                       create an order
GET  /orders/ord_8f2k              read one order
POST /orders/ord_8f2k/cancellation cancel it

Bad: POST /getOrders, POST /cancelOrder?id=8f2k

How to check

A linter such as Spectral, with a rule for plural nouns and no verbs, passes on the OpenAPI file.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers api design playbook: https://agentwranglers.se/playbook/api-design/resources-and-methods/resource-names.