Browsing the archives for the REST API tag.


Interesting REST API Decision

Software

Scenario: a database of images, with a REST API.

Get All is no problem: GET /images/
Get Single is no problem: GET /images/?id=12345
Add New is no problem: POST /images/ (header info)
Update is no problem: PUT /images/ (header info)

But what if I want to say to the API “I know you have an image, and I would like you to take that original image, make a copy, crop the copy to a dimensional size that I will provide to you, and then resize that cropped portion to a final size which I will also provide to you. Oh, and return the ID of the newly-created image.”

I guess technically I’m adding a new resource, but I’m not specifying the pure data for the new resource: I’m giving a set of transformations to apply to an existing resource.

Interesting conundrum. WWRFD?

No Comments