i junior programming , work on rest api, have question title shows. mean, how server process rest api request? create new file , store data in new-created file? store data in single(only one)file database does? example:
post http://www.example.com/customers
post http://www.example.com/customers/12345/orders
what server these 2 request? advice appreciated.
post
http's unconstrained method: can anything. disadvantage requests neither idempotent nor safe, means clients cannot safely repeat requests without risking unintended side-effects.
for little while, http spec worded bit strange saying "post creates child resource." has been cleaned in updated version, , post
described unconstrained method is: server can anything, meaning can store, or process, or else.
http/1.1 semantics: https://tools.ietf.org/html/rfc7231#section-4.3.3
get , put bit different because when using them, assumption can used idempotently (get
) or safely (put
). other http methods fit framework of being idempotent, safe, or none of those.
not recommend ever, in theory have working http rest api using post
, because post
can anything. badly designed api, lack lot of advantages well-designed http rest apis have.
Comments
Post a Comment