In this context, safe is not related to security
In the context of HTTP methods, safe is not related to security. Basically, safe means read-only.
RFC 7231
If you have any questions regarding the HTTP/1.1 protocol, the RFC 7231 is the best reference for you. The document defines the semantics and the content of the HTTP protocol.
Have a look at what it says about safe methods:
4.2.1. Safe Methods
Request methods are considered "safe" if their defined semantics are
essentially read-only; i.e., the client does not request, and does
not expect, any state change on the origin server as a result of
applying a safe method to a target resource. [...]
Of the request methods defined by this specification, the GET
, HEAD
,
OPTIONS
, and TRACE
methods are defined to be safe. [...]
Now, have a look at what it says about idempotent methods:
4.2.2. Idempotent Methods
A request method is considered "idempotent" if the intended effect on
the server of multiple identical requests with that method is the
same as the effect for a single such request. Of the request methods
defined by this specification, PUT
, DELETE
, and safe request methods
are idempotent. [...]
Summarizing, the HTTP methods are classified as following:
+---------+------+------------+
| Method | Safe | Idempotent |
+---------+------+------------+
| CONNECT | no | no |
| DELETE | no | yes |
| GET | yes | yes |
| HEAD | yes | yes |
| OPTIONS | yes | yes |
| POST | no | no |
| PUT | no | yes |
| TRACE | yes | yes |
+---------+------+------------+
Using the POST
verb
POST
is commonly used to create a new resource. But it's also a catch-all verb for operations that should not be executed using the other methods.
Use POST
for non safe operations (not read-only) and for non idempotent operations (multiple identical requests may have different effects).
Additional resources
In the following page, you'll find great answers regarding choosing PUT
or POST
in REST applications:
Below you'll find the current references for the HTTP/1.1 protocol: