3 ms·
I wouldn't think so. The sound the horn makes is the requested resource. You're not creating anything new by requesting that sound.
by yock 12y ago
I wouldn't think so. The sound the horn makes is the requested resource. You're not creating anything new by requesting that sound.
- TeMPOraL 12y agoI disagree; you're creating a sound. If anything, it should probably be PUT and should return 201 Created on success. There are a lot of state-changing commands there that are all GET. This API is definitely not REST (i.e. just because it uses HTTP, doesn't make it RESTful).
- nardi 12y agoDisagree with PUT. As stated above, this request is not idempotent (multiple requests result in multiple honks, not one), so it should be a POST (the only method intended for non-idempotent requests).
- shawnz 12y agoUsing a POST request would make sense in other ways, too. The endpoint could represent a timeline of all the honks that have occurred, and by POSTing to it you are creating a honk at the current time. On the other hand, PUT would make sense if you were specifying the time you wanted the honk to occur at as a parameter (and likewise that would be idempotent).