satoru
satoru

Reputation: 33235

What is a proper verb for appending items to a resource in REST API?

My resource URL looks like this: /container/:id

I need an API to append items to a container, so I come up with something like /container/:id/items, now what should be the verb? POST?

Upvotes: 1

Views: 195

Answers (1)

Tim
Tim

Reputation: 43354

Yes POST is correct here. It is used when creating new resources. An item in a container is a resource.

Say your container is a chat, and items are chat messages,

POST to /chat/:id/messages makes perfect sense.

Upvotes: 2

Related Questions