Skip to content

REST API

jjongwuner edited this page Jul 20, 2019 · 1 revision

REST API

The REST API consists of methods , resources, and messages.
For example, when you have an example of "Call a method that takes jjongwuner as a user"
The act is called the method., User is a resource., jjongwuner is a user message.

Exercise :

{
   "user" : {
          "name" : "jjongwuner"
    }
}

HTTP Method(CRUD)

Method Mean IdemPotent
Post Create No
GET Select(Read) YES
PUT Update YES
DELETE Delete YES

REST's Resource

jjongwuner is a user message. REST is a resource-oriented architecture style, so all definitions are expressed in nouns (method invocation, push, etc.)

If you define a resource type called user as http://myweb/users a resource with an id of jjongwuner is http://myweb/users /jjongwuner. As mentioned above, there may be confusion when defining command-oriented APIs.

Ex. "Send a push message" is usually an existing RPC (Remote Procedure Call) or a functional approach. It can be wrongly defined as /myweb/sendpush, but if you define it as a verb -> noun, It is a little easier to express. If you change the definition to "Create a push message request". API Format: POST/myweb/push. It is the design of REST type to be defined as resource type based noun form.

Ex. Simple User Creation API HTTP Post,

http://myweb/users/{ 
      "name": "jjongwuner",
      "address": "seoul" 
}

Clone this wiki locally