한국어

Coding

온누리070 플레이스토어 다운로드
    acrobits softphone
     온누리 070 카카오 프러스 친구추가온누리 070 카카오 프러스 친구추가친추
     카카오톡 채팅 상담 카카오톡 채팅 상담카톡
    
     라인상담
     라인으로 공유

     페북공유

   ◎위챗 : speedseoul


  
     PAYPAL
     
     PRICE
     

pixel.gif

    before pay call 0088 from app


https://blog.restcase.com/7-rules-for-rest-api-uri-design/


Before going over the rules for REST API URI design, let’s do a quick overview on some of the terms we are going to talk about.

URIs

REST APIs use Uniform Resource Identifiers (URIs) to address resources. On today’s web, URI designs range from masterpieces that clearly communicate the API’s resource model like: 
http://api.example.com/louvre/leonardo-da-vinci/mona-lisa 
to those that are much harder for people to understand, such as: 
http://api.example.com/68dd0-a9d3-11e0-9f1c-0800200c9a66

Tim Berners-Lee included a note about the opacity of URIs in his “Axioms of Web Architecture” list:

The only thing you can use an identifier for is to refer to an object. When you are not dereferencing, you should not look at the contents of the URI string to gain other information.
Tim Berners-Lee

Clients must follow the linking paradigm of the Web and treat URIs as opaque identifiers.

REST API designers should create URIs that convey a REST API’s resource model to its potential client developers. In this post, I will try to introduce a set of design rules for REST API URIs.

Prior diving to the rules, a word about the URI Format as the rules presented in this section pertain to the format of a URI. 
RFC 3986 defines the generic URI syntax as shown below:

URI = scheme "://" authority "/" path [ "?" query ] [ "#" fragment ]

Rule #1: A trailing forward slash (/) should not be included in URIs

This is one the most important rules to follow as the last character within a URI’s path, a forward slash (/) adds no semantic value and may cause confusion. REST API’s should not expect a trailing slash and should not include them in the links that they provide to clients.

Many web components and frameworks will treat the following two URIs equally: 
http://api.canvas.com/shapes/ 
http://api.canvas.com/shapes

However, every character within a URI counts toward a resource’s unique identity.

Two different URIs map to two different resources. If the URIs differ, then so do the resources, and vice versa. Therefore, a REST API must generate and communicate clean URIs and should be intolerant of any client’s attempts to identify a resource imprecisely.

More forgiving APIs may redirect clients to URIs without a trailing forward slash (they may also return the 301 – “Moved Permanently” that is used to relocate resources”).

Rule #2: Forward slash separator (/) must be used to indicate a hierarchical relationship

The forward slash (/) character is used in the path portion of the URI to indicate a hierarchical relationship between resources.

For example: 
http://api.canvas.com/shapes/polygons/quadrilaterals/squares

Rule #3: Hyphens (-) should be used to improve the readability of URIs

To make your URIs easy for people to scan and interpret, use the hyphen (-) character to improve the readability of names in long path segments. Anywhere you would use a space or hyphen in English, you should use a hyphen in a URI.

For example: 
http://api.example.com/blogs/guy-levin/posts/this-is-my-first-post

Rule #4: Underscores (_) should not be used in URIs

Text viewer applications (browsers, editors, etc.) often underline URIs to provide a visual cue that they are clickable. Depending on the application’s font, the underscore (_) character can either get partially obscured or completely hidden by this underlining.

To avoid this confusion, use hyphens (-) instead of underscores

Rule #5: Lowercase letters should be preferred in URI paths

When convenient, lowercase letters are preferred in URI paths since capital letters can sometimes cause problems. RFC 3986 defines URIs as case-sensitive except for the scheme and host components.

For example: 
http://api.example.com/my-folder/my-doc

HTTP://API.EXAMPLE.COM/my-folder/my-doc 
This URI is fine. The URI format specification (RFC 3986) considers this URI to be identical to URI #1.

http://api.example.com/My-Folder/my-doc 
This URI is not the same as URIs 1 and 2, which may cause unnecessary confusion.

Rule #6: File extensions should not be included in URIs

On the Web, the period (.) character is commonly used to separate the file name and extension portions of a URI. 
A REST API should not include artificial file extensions in URIs to indicate the format of a message’s entity body. Instead, they should rely on the media type, as communicated through the Content-Type header, to determine how to process the body’s content.

http://api.college.com/students/3248234/courses/2005/fall.json 
http://api.college.com/students/3248234/courses/2005/fall

File extensions should not be used to indicate format preference.

REST API clients should be encouraged to utilize HTTP’s provided format selection mechanism, the Accept request header.

To enable simple links and easy debugging, a REST API may support media type selection via a query parameter.

Rule #7: Should the endpoint name be singular or plural?

The keep-it-simple rule applies here. Although your inner-grammatician will tell you it's wrong to describe a single instance of a resource using a plural, the pragmatic answer is to keep the URI format consistent and always use a plural.

Not having to deal with odd pluralization (person/people, goose/geese) makes the life of the API consumer better and is easier for the API provider to implement (as most modern frameworks will natively handle /students and /students/3248234 under a common controller).

But how do you deal with relations? If a relation can only exist within another resource, RESTful principles provide useful guidance. Let's look at this with an example. A student has a number of courses. These courses are logically mapped to the /students endpoint as follows:

http://api.college.com/students/3248234/courses - Retrieves a list of all courses that are learned by a student with id 3248234. 
http://api.college.com/students/3248234/courses/physics - Retrieves course physics for a student with id 3248234.

Conclusion

When you are designing REST API services, you have to pay attention to resources, those are defined by URIs.

Each resource in a service or services you are building will have at least one URI identifying it. It's best when that URI makes sense and adequately describes the resource. URIs should follow a predictable, hierarchical structure to enhance understandability and, therefore, usability: predictable in the sense that they're consistent, hierarchical in the sense that data has structure—relationships.

RESTful APIs are written for consumers. The name and structure of URIs should convey meaning to those consumers. By following the above rules, you will create a much cleaner REST APIs with a much happier client. This is not a REST rule or constraint, but it enhances the API.

I also suggest that you will take a look at http://blog.restcase.com/5-basic-rest-api-design-guidelines/

Design for your clients, not for your data.

번호
제목
글쓴이
63 [SSL]HTTPS통신을 위한 SSL인증서 발급하기(OpenSSL) 원리까지 충실하게 설명잘됨
admin
10083   2020-02-13
 
62 인증 기관에서 발급한 SSL 인증서 설치 및 사용설명
admin
5324   2020-02-13
 
61 iOS NSURLSession Example (HTTP GET, POST, Background Downlads )
admin
7469   2019-06-04
 
60 iOS Tutorial - Part 26 - HttpRequest POST, GET (NSURLConnection)1
admin
6178   2019-05-20
 
59 Simple http post example in Objective-C?
admin
5699   2019-05-20
 
58 리눅스 CentOS 6.5 SSL 구축 방법
admin
7717   2018-06-01
 
57 무료 SSL 인증서 SSL For Free
admin
7765   2018-05-26
 
56 도메인클럽 m 또는 www등의 서브도메인(a레코드) 추가는 어디서 할 수 있나요?
admin
7003   2018-05-25
 
55 Certificate Installation : Node.js in Linux
admin
6298   2018-05-25
 
54 online-csr-and-key-generator CSR 온라인 제너레이터 생성 만들기 Private key
admin
6430   2018-05-25
 
53 COMODO SSL www.gogetssl.com namecheap.com SSL 인증서 구매 서버에 적용 순서
admin
9427   2018-05-25
 
52 인증서 취소 How to cancel an SSL certificate? www.namecheap.com
admin
8202   2018-05-25
 
51 Android SSL 프로그램 공인인증서 사설 인증서 ROOTCA Self-signed 인증서 에러 원인
admin
7027   2018-05-25
 
50 Retrofit is one of the most popular HTTP Client Library for Android 간결하고 요점정리
admin
7134   2018-05-23
 
49 SSL 프로그래밍 참고
admin
6378   2018-05-23
 
48 HTTPS 및 SSL을 사용한 보안 구글 문서
admin
9972   2018-05-23
 
47 Consuming APIs with Retrofit
admin
8422   2018-05-22
 
46 COMODO SSL Analyzer ip 도메인 모두 가능합니다
admin
6504   2018-05-22
 
45 OpenSSL 로 ROOT CA 생성 및 SSL 인증서 발급 순서 Self Signed Certificate
admin
7322   2018-05-22
 
44 Android에 루트 CA 설치
admin
8410   2018-05-22
 
43 How to update OpenSSL on Debian testing
admin
6962   2018-05-22
 
42 신뢰되지 않는 인증서를 사용하여 SSL 구성
admin
11437   2018-05-22
 
41 OpenSSL tips and common commands
admin
7158   2018-05-22
 
40 How to get FREE SSL Certificate for Website (HTTPS) 인증서 무료로 받기
admin
6263   2018-05-22
 
39 retropit
admin
6428   2018-05-20
 
38 SSL test code
admin
6915   2018-05-20
 
37 HttpsURLConnection в ASyncTask https
admin
6514   2018-05-19
 
36 protected String doInBackground(String... strings) {
admin
6395   2018-05-19
 
35 Using Google Spread sheet as DataBase Part -2
admin
6897   2018-05-19
 
34 Android: HTTPS (SSL) connection using HttpsURLConnection
admin
7111   2018-05-19
 
33 HttpsUrlConnection, you can refer to my following sample code good
admin
6439   2018-05-19
 
32 how to use HttpsUrlConnection instead of DefaultHttpClient
admin
6369   2018-05-19
 
31 Https simple get request
admin
6471   2018-05-19
 
30 Base64 encoded value of [API-key]:[API-Secret] appending the "Basic " string in start.
admin
7762   2018-05-19
 
29 Class: https.Server
admin
6936   2018-05-19
 
28 HTTP2 server push in depth with node.js
admin
7249   2018-05-19
 
27 HSTS forces the client (browser accessing your server) to direct all traffic through HTTPS
admin
6544   2018-05-19
 
26 https ssl node js real code
admin
6715   2018-05-19
 
25 https 및 openssl 키값 decoding 확인 ssl tls
admin
6625   2018-05-19
 
24 TLS/SSL Concepts nodejs how to
admin
7123   2018-05-19
 
23 HTTPS Authorized Certs with Node.js
admin
7307   2018-05-19
 
22 How to Use SSL/TLS with Node.js Related Topics
admin
7249   2018-05-19
 
21 openssl website
admin
6284   2018-05-19
 
20 node js HTTPS server and client
admin
7265   2018-05-19
 
19 RESTful API with NodeJS/Express mysql
admin
6790   2018-05-19
 
18 Build a Rest API for Node & Mysql 2018 JWT
admin
7076   2018-05-19
 
17 Using SSL with Express 4 and Node.js
admin
6973   2018-05-19
 
16 https node js rest api express
admin
6303   2018-05-19
 
15 9 FREE Useful Online SSL/TLS Certificate Tools
admin
7979   2018-05-19
 
14 Do you know where your app’s secrets are?
admin
7092   2018-05-19
 
13 node js rest with express
admin
7154   2018-05-19
 
12 simple HTTPS JSON REST server using node.js
admin
6337   2018-05-19
 
11 5 Ways to Make HTTP Requests in Node.js
admin
23248   2018-05-19
 
10 express() detail easy doc
admin
19249   2018-05-19
 
9 express https simple example
admin
6191   2018-05-19
 
8 Online CSR and Key Generator
admin
6314   2018-05-19
 
7 SSL Converter checker
admin
7091   2018-05-19
 
6 here is a complete working example. rest api https
admin
6235   2018-05-19
 
5 node-rest-client
admin
6994   2018-05-19
 
Rules for REST API URI Design
admin
7381   2018-05-19
https://blog.restcase.com/7-rules-for-rest-api-uri-design/ Before going over the rules for REST API URI design, let’s do a quick overview on some of the terms we are going to talk about. URIsREST APIs use...  
3 RESTful API Authentication Basics
admin
7706   2018-05-19
 
2 Benefits For REST APIs with HTTP/2 HTTP/1.x vs HTTP/2
admin
60998   2018-05-19
 
1 HTTPS, Redis, FCM, EC2 Setup 키생성 인증서 요청서 openssl 이용 상세한설명
admin
5868   2018-05-19