You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: azure/ConsiderationsForServiceDesign.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,7 @@ An important consideration when defining a new service is support for pagination
94
94
Another consideration for collections is support for sorting the set of returned items with the _orderby_ query parameter.
95
95
Sorting collection results can be extremely expensive for a service to implement as it must retrieve all items to sort them. And if the operation supports paging (which is likely), then a client request to get another page may have to retrieve all items and sort them again to determine which items are on the desired page.
96
96
97
-
:heavy_check_mark:**YOU MAY** support _orderby_ if customer scenarios really demand it and the service is confident that it can support it in perpetuity (even if the backing storage service changes someday).
97
+
:heavy_check_mark:**YOU MAY** support `orderby` if customer scenarios really demand it and the service is confident that it can support it in perpetuity (even if the backing storage service changes someday).
98
98
99
99
Another important design pattern for avoiding surprises is idempotency. An operation is idempotent if it can be performed multiple times and have the same result as a single execution.
100
100
HTTP requires certain operations like GET, PUT, and DELETE to be idempotent, but for cloud services it is important to make _all_ operations idempotent so that clients can use retry in failure scenarios without risk of unintended consequences.
Copy file name to clipboardExpand all lines: azure/Guidelines.md
+39-41Lines changed: 39 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -462,41 +462,41 @@ Note: To avoid potential collision of actions and resource ids, you should disal
462
462
463
463
Parameter name | Type | Description
464
464
------------------- | ---- | -----------
465
-
_filter_ | string | an expression on the resource type that selects the resources to be returned
466
-
_orderby_ | string array | a list of expressions that specify the order of the returned resources
467
-
_skip_ | integer | an offset into the collection of the first resource to be returned
468
-
_top_ | integer | the maximum number of resources to return from the collection
469
-
_maxpagesize_ | integer | the maximum number of resources to include in a single response
470
-
_select_ | string array | a list of field names to be returned for each resource
471
-
_expand_ | string array | a list of the related resources to be included in line with each resource
465
+
`filter` | string | an expression on the resource type that selects the resources to be returned
466
+
`orderby` | string array | a list of expressions that specify the order of the returned resources
467
+
`skip` | integer | an offset into the collection of the first resource to be returned
468
+
`top` | integer | the maximum number of resources to return from the collection
469
+
`maxpagesize` | integer | the maximum number of resources to include in a single response
470
+
`select` | string array | a list of field names to be returned for each resource
471
+
`expand` | string array | a list of the related resources to be included in line with each resource
472
472
473
473
:white_check_mark:**DO** return an error if the client specifies any parameter not supported by the service.
474
474
475
475
:white_check_mark:**DO** treat these query parameter names as case-sensitive.
476
476
477
-
:white_check_mark:**DO** apply _select_ or _expand_ options after applying all the query options in the table above.
477
+
:white_check_mark:**DO** apply `select` or `expand` options after applying all the query options in the table above.
478
478
479
479
:white_check_mark:**DO** apply the query options to the collection in the order shown in the table above.
480
480
481
481
:no_entry:**DO NOT** prefix any of these query parameter names with "$" (the convention in the [OData standard](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_QueryingCollections)).
482
482
483
-
#### filter
483
+
#### `filter`
484
484
485
-
:heavy_check_mark:**YOU MAY** support filtering of the results of a list operation with the _filter_ query parameter.
485
+
:heavy_check_mark:**YOU MAY** support `filter`ing of the results of a list operation with the `filter` query parameter.
486
486
487
-
The value of the _filter_ option is an expression involving the fields of the resource that produces a Boolean value. This expression is evaluated for each resource in the collection and only items where the expression evaluates to true are included in the response.
487
+
The value of the `filter` option is an expression involving the fields of the resource that produces a Boolean value. This expression is evaluated for each resource in the collection and only items where the expression evaluates to true are included in the response.
488
488
489
-
:white_check_mark:**DO** omit all resources from the collection for which the _filter_ expression evaluates to false or to null, or references properties that are unavailable due to permissions.
489
+
:white_check_mark:**DO** omit all resources from the collection for which the `filter` expression evaluates to false or to null, or references properties that are unavailable due to permissions.
490
490
491
491
Example: return all Products whose Price is less than $10.00
492
492
493
493
```http
494
-
GET https://api.contoso.com/products?filter=price lt 10.00
494
+
GET https://api.contoso.com/products?`filter`=price lt 10.00
495
495
```
496
496
497
-
##### filter operators
497
+
##### `filter` operators
498
498
499
-
:heavy_check_mark:**YOU MAY** support the following operators in _filter_ expressions:
499
+
:heavy_check_mark:**YOU MAY** support the following operators in `filter` expressions:
@@ -514,9 +514,9 @@ not | Logical negation | not price le 3.5
514
514
**Grouping Operators** | |
515
515
( ) | Precedence grouping | (priority eq 1 or city eq 'Redmond') and price gt 100
516
516
517
-
: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.
517
+
: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.
518
518
519
-
: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:
519
+
: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:
520
520
521
521
| Group | Operator | Description
522
522
| ----------------|----------|------------
@@ -531,50 +531,50 @@ not | Logical negation | not price le 3.5
531
531
| Conditional AND | and | Logical And |
532
532
| Conditional OR | or | Logical Or |
533
533
534
-
> :heavy_check_mark:**YOU MAY** support orderby and filter functions such as concat and contains. For more information, see [odata Canonical Functions](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#_Toc31360979).
534
+
> :heavy_check_mark:**YOU MAY** support orderby and `filter` functions such as concat and contains. For more information, see [odata Canonical Functions](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#_Toc31360979).
535
535
536
536
##### Operator examples
537
537
The following examples illustrate the use and semantics of each of the logical operators.
538
538
539
539
Example: all products with a name equal to 'Milk'
540
540
541
541
```http
542
-
GET https://api.contoso.com/products?filter=name eq 'Milk'
542
+
GET https://api.contoso.com/products?`filter`=name eq 'Milk'
543
543
```
544
544
545
545
Example: all products with a name not equal to 'Milk'
546
546
547
547
```http
548
-
GET https://api.contoso.com/products?filter=name ne 'Milk'
548
+
GET https://api.contoso.com/products?`filter`=name ne 'Milk'
549
549
```
550
550
551
551
Example: all products with the name 'Milk' that also have a price less than 2.55:
552
552
553
553
```http
554
-
GET https://api.contoso.com/products?filter=name eq 'Milk' and price lt 2.55
554
+
GET https://api.contoso.com/products?`filter`=name eq 'Milk' and price lt 2.55
555
555
```
556
556
557
557
Example: all products that either have the name 'Milk' or have a price less than 2.55:
558
558
559
559
```http
560
-
GET https://api.contoso.com/products?filter=name eq 'Milk' or price lt 2.55
560
+
GET https://api.contoso.com/products?`filter`=name eq 'Milk' or price lt 2.55
561
561
```
562
562
563
563
Example: all products that have the name 'Milk' or 'Eggs' and have a price less than 2.55:
564
564
565
565
```http
566
-
GET https://api.contoso.com/products?filter=(name eq 'Milk' or name eq 'Eggs') and price lt 2.55
566
+
GET https://api.contoso.com/products?`filter`=(name eq 'Milk' or name eq 'Eggs') and price lt 2.55
567
567
```
568
568
569
569
#### orderby
570
570
571
-
:heavy_check_mark:**YOU MAY** support sorting of the results of a list operation with the _orderby_ query parameter.
572
-
*NOTE: It is unusual for a service to support _orderby_ because it is very expensive to implement as it requires sorting the entire large collection before being able to return any results.*
571
+
:heavy_check_mark:**YOU MAY** support sorting of the results of a list operation with the `orderby` query parameter.
572
+
*NOTE: It is unusual for a service to support `orderby` because it is very expensive to implement as it requires sorting the entire large collection before being able to return any results.*
573
573
574
-
The value of the _orderby_ parameter is a comma-separated list of expressions used to sort the items.
574
+
The value of the `orderby` parameter is a comma-separated list of expressions used to sort the items.
575
575
A special case of such an expression is a property path terminating on a primitive property.
576
576
577
-
Each expression in the _orderby_ parameter value may include the suffix "asc" for ascending or "desc" for descending, separated from the expression by one or more spaces.
577
+
Each expression in the `orderby` parameter value may include the suffix "asc" for ascending or "desc" for descending, separated from the expression by one or more spaces.
578
578
579
579
:white_check_mark:**DO** sort the collection in ascending order on an expression if "asc" or "desc" is not specified.
580
580
@@ -596,38 +596,36 @@ For example, to return all people sorted by name in descending order and a secon
596
596
GET https://api.contoso.com/people?orderby=name desc,hireDate
597
597
```
598
598
599
-
Sorting MUST compose with filtering such that:
599
+
Sorting MUST compose with `filter`ing such that:
600
600
```http
601
-
GET https://api.contoso.com/people?filter=name eq 'david'&orderby=hireDate
601
+
GET https://api.contoso.com/people?`filter`=name eq 'david'&orderby=hireDate
602
602
```
603
603
will return all people whose name is David sorted in ascending order by hireDate.
604
604
605
605
##### Considerations for sorting with pagination
606
606
607
-
:white_check_mark:**DO** use the same filtering options and sort order for all pages of a paginated list operation response.
607
+
:white_check_mark:**DO** use the same `filter`ing options and sort order for all pages of a paginated list operation response.
608
608
609
609
##### skip
610
-
:white_check_mark:**DO** define the _skip_ parameter as an integer with a default and minimum value of 0.
610
+
:white_check_mark:**DO** define the `skip` parameter as an integer with a default and minimum value of 0.
611
611
612
-
:heavy_check_mark:**YOU MAY** allow clients to pass the _skip_ query parameter to specify an offset into collection of the first resource to be returned.
612
+
:heavy_check_mark:**YOU MAY** allow clients to pass the `skip` query parameter to specify an offset into collection of the first resource to be returned.
613
613
##### top
614
614
615
-
:heavy_check_mark:**YOU MAY** allow clients to pass the _top_ query parameter to specify the maximum number of resources to return from the collection.
615
+
:heavy_check_mark:**YOU MAY** allow clients to pass the `top` query parameter to specify the maximum number of resources to return from the collection.
616
616
617
-
If supporting _top_:
618
-
:white_check_mark:**DO** define the _top_ parameter as an integer with a minimum value of 1. If not specified, _top_ has a default value of infinity.
617
+
If supporting `top`:
618
+
:white_check_mark:**DO** define the `top` parameter as an integer with a minimum value of 1. If not specified, `top` has a default value of infinity.
619
619
620
-
:white_check_mark:**DO** return the collection's _top_ number of resources (if available), starting from _skip_.
620
+
:white_check_mark:**DO** return the collection's `top` number of resources (if available), starting from `skip`.
621
621
622
622
##### maxpagesize
623
623
624
-
:heavy_check_mark:**YOU MAY** allow clients to pass the _maxpagesize_ query parameter to specify the maximum number of resources to include in a single page response.
624
+
:heavy_check_mark:**YOU MAY** allow clients to pass the `maxpagesize` query parameter to specify the maximum number of resources to include in a single page response.
625
625
626
-
If supporting _maxpagesize_
626
+
:white_check_mark:**DO** define the `maxpagesize` parameter as an optional integer with a default value appropriate for the collection.
627
627
628
-
:white_check_mark:**DO** define the _maxpagesize_ parameter as an optional integer with a default value appropriate for the collection.
629
-
630
-
:white_check_mark:**DO** make clear in documentation of the _maxpagesize_ parameter that the operation may choose to return fewer resources than the value specified.
628
+
:white_check_mark:**DO** make clear in documentation of the `maxpagesize` parameter that the operation may choose to return fewer resources than the value specified.
0 commit comments