RESTful way to create multiple items in one request

I believe that another correct way to approach this would be to create another resource that represents your collection of resources. Example, imagine that we have an endpoint like /api/sheep/{id} and we can POST to /api/sheep to create a sheep resource. Now, if we want to support bulk creation, we should consider a new flock … Read more

API pagination best practices

I’m not completely sure how your data is handled, so this may or may not work, but have you considered paginating with a timestamp field? When you query /foos you get 100 results. Your API should then return something like this (assuming JSON, but if it needs XML the same principles can be followed): { … Read more

REST – put IDs in body or not?

There is nothing wrong in having different read/write models: the client can write one resource representation where after the server can return another representation with added/calculated elements in it (or even a completely different representation – there is nothing in any spec against that, the only requirement is that PUT should create or replace the … Read more

Delete multiple records using REST

Is a viable RESTful choice, but obviously has the limitations you have described. Don’t do this. It would be construed by intermediaries as meaning “DELETE the (single) resource at /records/1;2;3” — So a 2xx response to this may cause them to purge their cache of /records/1;2;3; not purge /records/1, /records/2 or /records/3; proxy a 410 response … Read more

Transactions in REST?

Consider a RESTful shopping basket scenario. The shopping basket is conceptually your transaction wrapper. In the same way that you can add multiple items to a shopping basket and then submit that basket to process the order, you can add Bob’s account entry to the transaction wrapper and then Bill’s account entry to the wrapper. … Read more

Basic HTTP and Bearer Token Authentication

Try this one to push basic authentication at url: curl -i http://username:password@dev.myapp.com/api/users -H “Authorization: Bearer mytoken123” ^^^^^^^^^^^^^^^^^^ If above one doesn’t work, then you have nothing to do with it. So try the following alternates. You can pass the token under another name. Because you are handling the authorization from your Application. So you can … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)