Skip to content

Commit bd7b1d9

Browse files
committed
Passel of structure, formmatting, and link fixes
1 parent a53aa65 commit bd7b1d9

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

azure/Guidelines.md

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ The Microsoft Azure Cloud platform exposes its APIs through the core building bl
4646

4747
### HTTP
4848
Azure services must adhere to the HTTP specification, [RFC7231](https://tools.ietf.org/html/rfc7231). This section further refines and constrains how service implementors should apply the constructs defined in the HTTP specification. It is therefore, important that you have a firm understanding of the following concepts:
49-
- [Uniform Resource Locators (URLs)](URLS)
50-
- HTTP Methods
51-
- Request & Response Headers
52-
- Bodies
5349

54-
### Uniform Resource Locators (URLs)
50+
- Uniform Resource Locators (URLs)
51+
- HTTP Request / Response Pattern
52+
- HTTP Query Parameters and Header Values
53+
54+
#### Uniform Resource Locators (URLs)
5555

5656
A Uniform Resource Locator (URL) is how developers access the resources of your service. Ultimately, URLs are how developers form a cognitive model of your service's resources.
5757

@@ -88,8 +88,6 @@ Some customer-provided path segment values may be compared case-insensitivity if
8888

8989
:heavy_check_mark: **YOU MAY** use these other characters in the URL path but they will likely require %-encoding [[RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986#section-2.1)]: `/ ? # [ ] @ ! $ & ' ( ) * + , ; =`
9090

91-
#### Direct Endpoint URLs
92-
9391
:heavy_check_mark: **YOU MAY** support a direct endpoint URL for performance/routing:
9492
```text
9593
https://<tenant>-<service-root>.<service>.<cloud>/...
@@ -103,16 +101,16 @@ Examples:
103101
:white_check_mark: **DO** return URLs in response headers/bodies in a consistent form regardless of the URL used to reach the resource. Either always a UUID for `<tenant>` or always a single verified domain.
104102

105103
:heavy_check_mark: **YOU MAY** use URLs as values
106-
```http
104+
```text
107105
https://api.contoso.com/items?url=https://resources.contoso.com/shoes/fancy
108106
```
109107

110-
### HTTP Request / Response Pattern
108+
#### HTTP Request / Response Pattern
111109
The HTTP Request / Response pattern dictates how your API behaves. For example: POST methods that create resources must be idempotent, GET method results may be cached, the If-Modified and ETag headers offer optimistic concurrency. The URL of a service, along with its request/response bodies, establishes the overall contract that developers have with your service. As a service provider, how you manage the overall request / response pattern should be one of the first implementation decisions you make.
112110

113111
Cloud applications embrace failure. Therefore, to enable customers to write fault-tolerant applications, _all_ service operations (including POST) **must** be idempotent. Implementing services in an idempotent manner, with an "exactly once" semantic, enables developers to retry requests without the risk of unintended consequences.
114112

115-
#### Exactly Once Behavior = Client Retries & Service Idempotency
113+
##### Exactly Once Behavior = Client Retries & Service Idempotency
116114

117115
:white_check_mark: **DO** ensure that _all_ HTTP methods are idempotent.
118116

@@ -146,7 +144,7 @@ DELETE | Remove the resource | `204-No Content`\; avoid `404-Not Found`
146144

147145
:white_check_mark: **DO** support caching and optimistic concurrency by honoring the the `If-Match`, `If-None-Match`, if-modified-since, and if-unmodified-since request headers and by returning the ETag and last-modified response headers
148146

149-
### HTTP Query Parameters and Header Values
147+
#### HTTP Query Parameters and Header Values
150148
Because information in the service URL, as well as the request / response, are strings, there must be a predictable, well-defined scheme to convert strings to their corresponding values.
151149

152150
:white_check_mark: **DO** validate all query parameter and request header values and fail the operation with `400-Bad Request` if any value fails validation. Return an error response as described in the [Handling Errors](#Handling-errors) section indicating what is wrong so customer can diagnose the issue and fix it themselves.
@@ -215,7 +213,7 @@ Your service should include the `x-ms-request-id` value in error logs so that us
215213

216214
### REpresentational State Transfer (REST)
217215
REST is an architectural style with broad reach that emphasizes scalability, generality, independent deployment, reduced latency via caching, and security. When applying REST to your API, you define your service’s resources as a collections of items.
218-
These are typically the nouns you use in the vocabulary of your service. Your service's [URLs](#URLS) determine the hierarchical path developers use to perform CRUD (create, read, update, and delete) operations on resources. Note, it's important to model resource state, not behavior.
216+
These are typically the nouns you use in the vocabulary of your service. Your service's [URLs](#uniform-resource-locators-urls) determine the hierarchical path developers use to perform CRUD (create, read, update, and delete) operations on resources. Note, it's important to model resource state, not behavior.
219217
There are patterns, later in these guidelines, that describe how to invoke behavior on your service. See [this article in the Azure Architecture Center](https://docs.microsoft.com/en-us/azure/architecture/best-practices/api-design) for a more detailed discussion of REST API design patterns.
220218

221219
When designing your service, it is important to optimize for the developer using your API.
@@ -444,23 +442,23 @@ The REST specification is used to model the state of a resource, and is primaril
444442

445443
:ballot_box_with_check: **YOU SHOULD** pattern your URL like this to perform an action on a resource
446444
**URL Pattern**
447-
```http
445+
```text
448446
https://.../<resource-collection>/<resource-id>:<action>?<input parameters>
449447
```
450448

451449
**Example**
452-
```http
450+
```text
453451
https://.../users/Bob:grant?access=read
454452
```
455453

456454
:ballot_box_with_check: **YOU SHOULD** pattern your URL like this to perform an action on a collection
457455
**URL Pattern**
458-
```http
456+
```text
459457
https://.../<resource-collection>:<action>?<input parameters>
460458
```
461459

462460
**Example**
463-
```http
461+
```text
464462
https://.../users:grant?access=read
465463
```
466464

@@ -542,7 +540,7 @@ The value of the `filter` option is an expression involving the fields of the re
542540

543541
Example: return all Products whose Price is less than $10.00
544542

545-
```http
543+
```text
546544
GET https://api.contoso.com/products?`filter`=price lt 10.00
547545
```
548546

@@ -566,7 +564,7 @@ not | Logical negation | not price le 3.5
566564
**Grouping Operators** | |
567565
( ) | Precedence grouping | (priority eq 1 or city eq 'Redmond') and price gt 100
568566

569-
:white_check_mark: **DO** respond with an error message as defined in the [Handling Errors](handling-errors) section if a client includes an operator in a `filter` expression that is not supported by the operation.
567+
:white_check_mark: **DO** respond with an error message as defined in the [Handling Errors](#handling-errors) section if a client includes an operator in a `filter` expression that is not supported by the operation.
570568

571569
:white_check_mark: **DO** use the following operator precedence for supported operators when evaluating `filter` expressions. Operators are listed by category in order of precedence from highest to lowest. Operators in the same category have equal precedence and should be evaluated left to right:
572570

@@ -590,31 +588,31 @@ The following examples illustrate the use and semantics of each of the logical o
590588

591589
Example: all products with a name equal to 'Milk'
592590

593-
```http
591+
```text
594592
GET https://api.contoso.com/products?`filter`=name eq 'Milk'
595593
```
596594

597595
Example: all products with a name not equal to 'Milk'
598596

599-
```http
597+
```text
600598
GET https://api.contoso.com/products?`filter`=name ne 'Milk'
601599
```
602600

603601
Example: all products with the name 'Milk' that also have a price less than 2.55:
604602

605-
```http
603+
```text
606604
GET https://api.contoso.com/products?`filter`=name eq 'Milk' and price lt 2.55
607605
```
608606

609607
Example: all products that either have the name 'Milk' or have a price less than 2.55:
610608

611-
```http
609+
```text
612610
GET https://api.contoso.com/products?`filter`=name eq 'Milk' or price lt 2.55
613611
```
614612

615613
Example: all products that have the name 'Milk' or 'Eggs' and have a price less than 2.55:
616614

617-
```http
615+
```text
618616
GET https://api.contoso.com/products?`filter`=(name eq 'Milk' or name eq 'Eggs') and price lt 2.55
619617
```
620618

@@ -639,17 +637,17 @@ Each expression in the `orderby` parameter value may include the suffix "asc" fo
639637
:white_check_mark: **DO** respond with an error message as defined in the [Handling Errors](#Handling-errors) section if the client requests sorting by a field that is not supported by the operation.
640638

641639
For example, to return all people sorted by name in ascending order:
642-
```http
640+
```text
643641
GET https://api.contoso.com/people?orderby=name
644642
```
645643

646644
For example, to return all people sorted by name in descending order and a secondary sort order of hireDate in ascending order.
647-
```http
645+
```text
648646
GET https://api.contoso.com/people?orderby=name desc,hireDate
649647
```
650648

651649
Sorting MUST compose with `filter`ing such that:
652-
```http
650+
```text
653651
GET https://api.contoso.com/people?`filter`=name eq 'david'&orderby=hireDate
654652
```
655653
will return all people whose name is David sorted in ascending order by hireDate.
@@ -691,7 +689,7 @@ Azure services need to change over time. However, when changing a service, there
691689

692690
:white_check_mark: **DO** use an `api-version` query parameter with a `YYYY-MM-DD` date value, with a `-preview` suffix for a preview service.
693691

694-
```http
692+
```text
695693
PUT https://service.azure.com/users/Jeff?api-version=2021-06-04
696694
```
697695

0 commit comments

Comments
 (0)