Is there a proper RESTful way to handle a request that does not actually create or receive something?

I am writing a small application that does only one thing: it takes some user-provided data, does some analysis on it and returns a “tag” for that data. I think that the client should either GET, or POSTtheir request /getTag, to receive a response.

Nothing is stored on the server when the client does this, so it is strange to use POST. However, there is no single URI for analysis, so using a GET seems weird because it will return different things depending on what data is provided.

What is the best way to represent this function with REST?

+5
source share
5

" " - , . , :

  • GET , - , , .

  • GET URI, . , , HTTP, /tag GET.

  • ( "" ) URI . , (. , , ).

, GET /tag?foo=bar&beef=dead, .

+2

POST . .

, , - . RPC POST. , REST, URL- JSON.

+1

, , , , , , , , ?

, POST /tags URI /tags/:id Location.

, , " " . "" , , GET /tag API.

+1

: GET. , , , , GET.

0

GET POST:

  • GET /tag?data="..." -> 200, tag

    GET ( ) Request-URI. Request-URI , , , , .

  • POST /tag {data: "..."} -> 200, tag

    , POST, URI. 200 (OK), 204 ( ) - , , , .

HTTP/ .

GET, ( POST, ).

0

All Articles