한국어

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
8056   2020-02-13
 
62 인증 기관에서 발급한 SSL 인증서 설치 및 사용설명
admin
3565   2020-02-13
 
61 iOS NSURLSession Example (HTTP GET, POST, Background Downlads )
admin
5630   2019-06-04
 
60 iOS Tutorial - Part 26 - HttpRequest POST, GET (NSURLConnection)1
admin
4453   2019-05-20
 
59 Simple http post example in Objective-C?
admin
3998   2019-05-20
 
58 리눅스 CentOS 6.5 SSL 구축 방법
admin
6069   2018-06-01
 
57 무료 SSL 인증서 SSL For Free
admin
6098   2018-05-26
 
56 도메인클럽 m 또는 www등의 서브도메인(a레코드) 추가는 어디서 할 수 있나요?
admin
5162   2018-05-25
 
55 Certificate Installation : Node.js in Linux
admin
4575   2018-05-25
 
54 online-csr-and-key-generator CSR 온라인 제너레이터 생성 만들기 Private key
admin
4737   2018-05-25
 
53 COMODO SSL www.gogetssl.com namecheap.com SSL 인증서 구매 서버에 적용 순서
admin
6804   2018-05-25
 
52 인증서 취소 How to cancel an SSL certificate? www.namecheap.com
admin
4963   2018-05-25
 
51 Android SSL 프로그램 공인인증서 사설 인증서 ROOTCA Self-signed 인증서 에러 원인
admin
5351   2018-05-25
 
50 Retrofit is one of the most popular HTTP Client Library for Android 간결하고 요점정리
admin
5455   2018-05-23
 
49 SSL 프로그래밍 참고
admin
4745   2018-05-23
 
48 HTTPS 및 SSL을 사용한 보안 구글 문서
admin
8082   2018-05-23
 
47 Consuming APIs with Retrofit
admin
5447   2018-05-22
 
46 COMODO SSL Analyzer ip 도메인 모두 가능합니다
admin
4874   2018-05-22
 
45 OpenSSL 로 ROOT CA 생성 및 SSL 인증서 발급 순서 Self Signed Certificate
admin
5614   2018-05-22
 
44 Android에 루트 CA 설치
admin
6712   2018-05-22
 
43 How to update OpenSSL on Debian testing
admin
5166   2018-05-22
 
42 신뢰되지 않는 인증서를 사용하여 SSL 구성
admin
9728   2018-05-22
 
41 OpenSSL tips and common commands
admin
5510   2018-05-22
 
40 How to get FREE SSL Certificate for Website (HTTPS) 인증서 무료로 받기
admin
4638   2018-05-22
 
39 retropit
admin
4795   2018-05-20
 
38 SSL test code
admin
5210   2018-05-20
 
37 HttpsURLConnection в ASyncTask https
admin
4874   2018-05-19
 
36 protected String doInBackground(String... strings) {
admin
4649   2018-05-19
 
35 Using Google Spread sheet as DataBase Part -2
admin
5179   2018-05-19
 
34 Android: HTTPS (SSL) connection using HttpsURLConnection
admin
5415   2018-05-19
 
33 HttpsUrlConnection, you can refer to my following sample code good
admin
4687   2018-05-19
 
32 how to use HttpsUrlConnection instead of DefaultHttpClient
admin
4734   2018-05-19
 
31 Https simple get request
admin
4853   2018-05-19
 
30 Base64 encoded value of [API-key]:[API-Secret] appending the "Basic " string in start.
admin
5980   2018-05-19
 
29 Class: https.Server
admin
5192   2018-05-19
 
28 HTTP2 server push in depth with node.js
admin
5520   2018-05-19
 
27 HSTS forces the client (browser accessing your server) to direct all traffic through HTTPS
admin
4826   2018-05-19
 
26 https ssl node js real code
admin
5085   2018-05-19
 
25 https 및 openssl 키값 decoding 확인 ssl tls
admin
4975   2018-05-19
 
24 TLS/SSL Concepts nodejs how to
admin
5356   2018-05-19
 
23 HTTPS Authorized Certs with Node.js
admin
5525   2018-05-19
 
22 How to Use SSL/TLS with Node.js Related Topics
admin
5412   2018-05-19
 
21 openssl website
admin
4624   2018-05-19
 
20 node js HTTPS server and client
admin
4832   2018-05-19
 
19 RESTful API with NodeJS/Express mysql
admin
5064   2018-05-19
 
18 Build a Rest API for Node & Mysql 2018 JWT
admin
5433   2018-05-19
 
17 Using SSL with Express 4 and Node.js
admin
5248   2018-05-19
 
16 https node js rest api express
admin
4654   2018-05-19
 
15 9 FREE Useful Online SSL/TLS Certificate Tools
admin
6339   2018-05-19
 
14 Do you know where your app’s secrets are?
admin
5358   2018-05-19
 
13 node js rest with express
admin
5526   2018-05-19
 
12 simple HTTPS JSON REST server using node.js
admin
4730   2018-05-19
 
11 5 Ways to Make HTTP Requests in Node.js
admin
21357   2018-05-19
 
10 express() detail easy doc
admin
17146   2018-05-19
 
9 express https simple example
admin
4563   2018-05-19
 
8 Online CSR and Key Generator
admin
4708   2018-05-19
 
7 SSL Converter checker
admin
5428   2018-05-19
 
6 here is a complete working example. rest api https
admin
4684   2018-05-19
 
5 node-rest-client
admin
5313   2018-05-19
 
Rules for REST API URI Design
admin
5712   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
6072   2018-05-19
 
2 Benefits For REST APIs with HTTP/2 HTTP/1.x vs HTTP/2
admin
59114   2018-05-19
 
1 HTTPS, Redis, FCM, EC2 Setup 키생성 인증서 요청서 openssl 이용 상세한설명
admin
4257   2018-05-19