idnits 2.17.1 draft-ietf-regext-rdap-sorting-and-paging-04.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (August 1, 2019) is 1702 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '0' on line 484 -- Looks like a reference, but probably isn't: '1' on line 500 -- Looks like a reference, but probably isn't: '3' on line 501 -- Looks like a reference, but probably isn't: '6' on line 497 == Unused Reference: 'RFC5226' is defined on line 871, but no explicit reference was found in the text == Unused Reference: 'RFC8605' is defined on line 924, but no explicit reference was found in the text ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7482 (Obsoleted by RFC 9082) ** Obsolete normative reference: RFC 7483 (Obsoleted by RFC 9083) ** Downref: Normative reference to an Informational RFC: RFC 8605 Summary: 5 errors (**), 0 flaws (~~), 3 warnings (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Registration Protocols Extensions M. Loffredo 3 Internet-Draft M. Martinelli 4 Intended status: Standards Track IIT-CNR/Registro.it 5 Expires: February 2, 2020 S. Hollenbeck 6 Verisign Labs 7 August 1, 2019 9 Registration Data Access Protocol (RDAP) Query Parameters for Result 10 Sorting and Paging 11 draft-ietf-regext-rdap-sorting-and-paging-04 13 Abstract 15 The Registration Data Access Protocol (RDAP) does not include core 16 functionality for clients to provide sorting and paging parameters 17 for control of large result sets. This omission can lead to 18 unpredictable server processing of queries and client processing of 19 responses. This unpredictability can be greatly reduced if clients 20 can provide servers with their preferences for managing large 21 responses. This document describes RDAP query extensions that allow 22 clients to specify their preferences for sorting and paging result 23 sets. 25 Status of This Memo 27 This Internet-Draft is submitted in full conformance with the 28 provisions of BCP 78 and BCP 79. 30 Internet-Drafts are working documents of the Internet Engineering 31 Task Force (IETF). Note that other groups may also distribute 32 working documents as Internet-Drafts. The list of current Internet- 33 Drafts is at https://datatracker.ietf.org/drafts/current/. 35 Internet-Drafts are draft documents valid for a maximum of six months 36 and may be updated, replaced, or obsoleted by other documents at any 37 time. It is inappropriate to use Internet-Drafts as reference 38 material or to cite them other than as "work in progress." 40 This Internet-Draft will expire on February 2, 2020. 42 Copyright Notice 44 Copyright (c) 2019 IETF Trust and the persons identified as the 45 document authors. All rights reserved. 47 This document is subject to BCP 78 and the IETF Trust's Legal 48 Provisions Relating to IETF Documents 49 (https://trustee.ietf.org/license-info) in effect on the date of 50 publication of this document. Please review these documents 51 carefully, as they describe your rights and restrictions with respect 52 to this document. Code Components extracted from this document must 53 include Simplified BSD License text as described in Section 4.e of 54 the Trust Legal Provisions and are provided without warranty as 55 described in the Simplified BSD License. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 60 1.1. Conventions Used in This Document . . . . . . . . . . . . 4 61 2. RDAP Query Parameter Specification . . . . . . . . . . . . . 4 62 2.1. Sorting and Paging Metadata . . . . . . . . . . . . . . . 4 63 2.2. "count" Parameter . . . . . . . . . . . . . . . . . . . . 6 64 2.3. "sort" Parameter . . . . . . . . . . . . . . . . . . . . 7 65 2.3.1. Sorting Properties Declaration . . . . . . . . . . . 7 66 2.3.2. Representing Sorting Links . . . . . . . . . . . . . 11 67 2.4. "cursor" Parameter . . . . . . . . . . . . . . . . . . . 12 68 2.4.1. Representing Paging Links . . . . . . . . . . . . . . 15 69 3. Negative Answers . . . . . . . . . . . . . . . . . . . . . . 16 70 4. RDAP Conformance . . . . . . . . . . . . . . . . . . . . . . 17 71 5. Implementation Considerations . . . . . . . . . . . . . . . . 17 72 6. Implementation Status . . . . . . . . . . . . . . . . . . . . 17 73 6.1. IIT-CNR/Registro.it . . . . . . . . . . . . . . . . . . . 18 74 6.2. Google Registry . . . . . . . . . . . . . . . . . . . . . 18 75 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 18 76 8. Security Considerations . . . . . . . . . . . . . . . . . . . 19 77 9. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 19 78 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 19 79 10.1. Normative References . . . . . . . . . . . . . . . . . . 19 80 10.2. Informative References . . . . . . . . . . . . . . . . . 21 81 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 22 82 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 22 84 1. Introduction 86 The availability of functionality for result sorting and paging 87 provides benefits to both clients and servers in the implementation 88 of RESTful services [REST]. These benefits include: 90 o reducing the server response bandwidth requirements; 91 o improving server response time; 92 o improving query precision and, consequently, obtaining more 93 reliable results; 94 o decreasing server query processing load; 95 o reducing client response processing time. 97 Approaches to implementing features for result sorting and paging can 98 be grouped into two main categories: 100 1. Sorting and paging are implemented through the introduction of 101 additional parameters in the query string (i.e. ODATA protocol 102 [OData-Part1]); 104 2. Information related to the number of results and the specific 105 portion of the result set to be returned, in addition to a set of 106 ready-made links for the result set scrolling, are inserted in 107 the HTTP header of the request/response. 109 However, there are some drawbacks associated with use of the HTTP 110 header. First, the header properties cannot be set directly from a 111 web browser. Moreover, in an HTTP session, the information on the 112 status (i.e. the session identifier) is usually inserted in the 113 header or in the cookies, while the information on the resource 114 identification or the search type is included in the query string. 115 The second approach is therefore not compliant with the HTTP standard 116 [RFC7230]. As a result, this document describes a specification 117 based on use of query parameters. 119 Currently the RDAP protocol [RFC7482] defines two query types: 121 o lookup: the server returns only one object; 122 o search: the server returns a collection of objects. 124 While the lookup query does not raise issues in the response 125 management, the search query can potentially generate a large result 126 set that could be truncated according to the server limits. In 127 addition, it is not possible to obtain the total number of the 128 objects found that might be returned in a search query response 129 [RFC7483]. Lastly, there is no way to specify sort criteria to 130 return the most relevant objects at the beginning of the result set. 131 Therefore, the client might traverse the whole result set to find the 132 relevant objects or, due to truncation, could not find them at all. 134 The specification described in this document extends RDAP query 135 capabilities to enable result sorting and paging, by adding new query 136 parameters that can be applied to RDAP search path segments. The 137 service is implemented using the Hypertext Transfer Protocol (HTTP) 138 [RFC7230] and the conventions described in RFC 7480 [RFC7480]. 140 The implementation of the new parameters is technically feasible, as 141 operators for counting, sorting and paging rows are currently 142 supported by the major RDBMSs. 144 1.1. Conventions Used in This Document 146 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 147 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 148 document are to be interpreted as described in [RFC2119]. 150 2. RDAP Query Parameter Specification 152 The new query parameters are OPTIONAL extensions of path segments 153 defined in RFC 7482 [RFC7482]. They are as follows: 155 o "count": a boolean value that allows a client to request the total 156 number of objects found (that due to truncation can be different 157 from the number of returned objects); 159 o "sort": a string value that allows a client to request a specific 160 sort order for the result set; 162 o "cursor": a string value representing a pointer to a specific 163 fixed size portion of the result set. 165 Augmented Backus-Naur Form (ABNF) [RFC5234] is used in the following 166 sections to describe the formal syntax of these new parameters. 168 2.1. Sorting and Paging Metadata 170 According to most advanced principles in REST design, collectively 171 known as HATEOAS (Hypermedia as the Engine of Application State) 172 ([HATEOAS]), a client entering a REST application through an initial 173 URI should use the server-provided links to dynamically discover 174 available actions and access the resources it needs. In this way, 175 the client is not requested to have prior knowledge of the service 176 and, consequently, to hard code the URIs of different resources. 177 This would allow the server to make URI changes as the API evolves 178 without breaking the clients. Definitively, a REST service should be 179 as self-descriptive as possible. 181 Therefore, servers implementing the query parameters described in 182 this specification SHOULD provide additional information in their 183 responses about both the available sorting criteria and the possible 184 pagination. Such information is collected in two new data structures 185 named, respectively, "sorting_metadata" and "paging_metadata". 187 Obviously, both the new data structures are OPTIONAL because their 188 presence in the response not only depends on the implementation of 189 sorting and paging query capabilities but also on some situations 190 related to the results. For example, it is quite natural to expect 191 that the "paging_metadata" element will not be present at the last 192 result page when the server implements only the forward pagination. 194 The "sorting_metadata" structure contains the following properties: 196 o "currentSort": "String" (OPTIONAL) either the value of sort 197 "parameter" as specified in the query string or the sort applied 198 by default, if any; 200 o "availableSorts": "AvailableSort[]" (OPTIONAL) an array of objects 201 each one describing an alternate available sorting criterion. 202 Members are: 204 * "property": "String" (REQUIRED) the name that can be used by 205 the client to request the sorting criterion; 206 * "default": "Boolean" (REQUIRED) whether the sorting criterion 207 is applied by default; 208 * "jsonPath": "String" (OPTIONAL) the JSON Path of the RDAP field 209 corresponding to the property; 210 * "links": "Link[]" (OPTIONAL) an array of links as described in 211 RFC 8288 [RFC8288] containing the query string that applies the 212 sorting criterion. 214 At least one between "currentSort" and "availableSorts" MUST be 215 present. 217 The "paging_metadata" structure contains the following fields: 219 o "totalCount": "Numeric" (OPTIONAL) a numeric value representing 220 the total number of objects found. It is provided if the query 221 string contains the "count" parameter; 223 o "pageCount": "Numeric" (OPTIONAL) a numeric value representing the 224 number of objects returned in the current page. It is provided 225 when the total number of objects exceeds the page size. This 226 property is redundant for clients because the page size can be 227 derived from the length of the search results array but it can be 228 helpful if the end user interacts with the server through a web 229 browser; 231 o "links": "Link[]" (OPTIONAL) an array of links as described in RFC 232 8288 [RFC8288] containing the reference to next page. In this 233 specification, only the forward pagination is dealt because it is 234 considered satisfactory in order to traverse the result set. 235 Examples of additional references are to: the previous page, the 236 first page, the last page. 238 At least one between "totalCount" and "links" MUST be present. 240 2.2. "count" Parameter 242 Currently the RDAP protocol does not allow a client to determine the 243 total number of the results in a query response when the result set 244 is truncated. This is rather inefficient because the user cannot 245 evaluate the query precision and, at the same time, cannot receive 246 information that could be relevant. 248 The "count" parameter provides additional functionality (Figure 1) 249 that allows a client to request information from the server that 250 specifies the total number of elements matching the search pattern. 252 https://example.com/rdap/domains?name=*nr.com&count=true 254 Figure 1: Example of RDAP query reporting the "count" parameter 256 The ABNF syntax is the following: 258 count = "count=" ( trueValue / falseValue ) 259 trueValue = ("true" / "yes" / "1") 260 falseValue = ("false" / "no" / "0") 262 A trueValue means that the server MUST provide the total number of 263 the objects in the "totalCount" field of the "paging_metadata" 264 element (Figure 2). A falseValue means that the server MUST NOT 265 provide this number. 267 { 268 "rdapConformance": [ 269 "rdap_level_0", 270 "paging_level_0" 271 ], 272 ... 273 "paging_metadata": { 274 "totalCount": 73 275 }, 276 "domainSearchResults": [ 277 ... 278 ] 279 } 281 Figure 2: Example of RDAP response with "paging_metadata" element 282 containing the "totalCount" field 284 2.3. "sort" Parameter 286 The RDAP protocol does not provide any capability to specify results 287 sort criteria. A server could implement a default sorting scheme 288 according to the object class, but this feature is not mandatory and 289 might not meet user requirements. Sorting can be addressed by the 290 client, but this solution is rather inefficient. Sorting features 291 provided by the RDAP server could help avoid truncation of relevant 292 results. 294 The "sort" parameter allows the client to ask the server to sort the 295 results according to the values of one or more properties and 296 according to the sort direction of each property. The ABNF syntax is 297 the following: 299 sort = "sort=" sortItem *( "," sortItem ) 300 sortItem = property-ref [":" ( "a" / "d" ) ] 301 property-ref = ALPHA *( ALPHA / DIGIT / "_" ) 303 "a" means that the ascending sort MUST be applied, "d" means that the 304 descending sort MUST be applied. If the sort direction is absent, an 305 ascending sort MUST be applied (Figure 3). 307 https://example.com/rdap/domains?name=*nr.com&sort=name 309 https://example.com/rdap/domains?name=*nr.com&sort=registrationDate:d 311 https://example.com/rdap/domains?name=*nr.com&sort=lockedDate,name 313 Figure 3: Examples of RDAP query reporting the "sort" parameter 315 Servers MUST implement sorting according to the JSON value type of 316 the RDAP field the sorting property refers to: the lexicographic 317 sorting for strings and the numeric sorting for numbers. 319 If the "sort" parameter reports an allowed sorting property, it MUST 320 be provided in the "currentSort" field of the "sorting_metadata" 321 element. 323 2.3.1. Sorting Properties Declaration 325 In the "sort" parameter ABNF syntax, property-ref represents a 326 reference to a property of an RDAP object. Such a reference could be 327 expressed by using a JSON Path. The JSON Path in a JSON document 328 [RFC8259] is equivalent to the XPath [W3C.CR-xpath-31-20161213] in a 329 XML document. For example, the JSON Path to select the value of the 330 ASCII name inside an RDAP domain object is "$.ldhName", where $ 331 identifies the root of the document (DOM). Another way to select a 332 value inside a JSON document is the JSON Pointer [RFC6901]. While 333 JSON Path or JSON Pointer are both standard ways to select any value 334 inside JSON data, neither is particularly easy to use (e.g. 335 "$.events[?(@.eventAction='registration')].eventDate" is the JSON 336 Path expression of the registration date in an RDAP domain object). 338 Therefore, this specification provides a definition of property-ref 339 in terms of RDAP properties. However, not all the RDAP properties 340 are suitable to be used in sort criteria, such as: 342 o properties providing service information (e.g. links, notices, 343 remarks, etc.); 345 o multivalued properties (e.g. status, roles, variants, etc.); 347 o properties modeling relationships to other objects (e.g. 348 entities). 350 On the contrary, some properties expressed as values of other 351 properties (e.g. registration date) could be used in such a context. 353 In the following, a list of properties an RDAP server MAY implement 354 is presented. The properties are divided in two groups: object 355 common properties and object specific properties. 357 o Object common properties. Object common properties are derived 358 from the merge of the "eventAction" and the "eventDate" 359 properties. The following values of the "sort" parameter are 360 defined: 362 * registrationDate 363 * reregistrationDate 364 * lastChangedDate 365 * expirationDate 366 * deletionDate 367 * reinstantiationDate 368 * transferDate 369 * lockedDate 370 * unlockedDate 372 o Object specific properties. With regard to the specific 373 properties, some of them are already defined among the query 374 paths. In the following a list of possible sorting properties, 375 grouped by objects, is shown: 377 * Domain: name 378 * Nameserver: name, ipV4, ipV6. 380 * Entity: fn, handle, org, email, voice, country, cc, city. 382 The correspondence between the sorting properties and the RDAP fields 383 is shown in Table 1: 385 +-----------+-----------+---------------------+------+-------+------+ 386 | Object | Sorting | RDAP property | RFC | RFC | RFC | 387 | class | property | | 7483 | 6350 | 8605 | 388 +-----------+-----------+---------------------+------+-------+------+ 389 | Searchabl | Common pr | eventAction values | 4.5. | | | 390 | e objects | operties | suffixed by "Date" | | | | 391 | | | | | | | 392 | Domain | name | unicodeName/ldhName | 5.3. | | | 393 | | | | | | | 394 | Nameserve | name | unicodeName/ldhName | 5.2. | | | 395 | r | | | | | | 396 | | ipV4 | v4 ipAddress | 5.2. | | | 397 | | ipV6 | v6 ipAddress | 5.2. | | | 398 | | | | | | | 399 | Entity | handle | handle | 5.1. | | | 400 | | fn | vcard fn | 5.1. | 6.2.1 | | 401 | | org | vcard org | 5.1. | 6.6.4 | | 402 | | voice | vcard tel with | 5.1. | 6.4.1 | | 403 | | | type="voice" | | | | 404 | | email | vcard email | 5.1. | 6.4.2 | | 405 | | country | country name in | 5.1. | 6.3.1 | | 406 | | | vcard adr | | | | 407 | | cc | country code in | 5.1. | | 3.1 | 408 | | | vcard adr | | | | 409 | | city | locality in vcard | 5.1. | 6.3.1 | | 410 | | | adr | | | | 411 +-----------+-----------+---------------------+------+-------+------+ 413 Table 1: Sorting properties definition 415 With regard to the definitions in Table 1, some further 416 considerations must be made to disambiguate some cases: 418 o since the response to a search on either domains or nameservers 419 might include both A-labels and U-labels ([RFC5890]) in general, a 420 consistent sorting policy shall take unicodeName and ldhName as 421 two formats of the same value rather than separately. Therefore, 422 the unicodeName value MUST be taken while sorting, when 423 unicodeName is missing, the value of ldhName MUST be considered 424 instead; 426 o the jCard "sort-as" parameter MUST be ignored for the purpose of 427 the sorting capability as described in this document; 429 o even if a nameserver can have multiple IPv4 and IPv6 addresses, 430 the most common configuration includes one address for each IP 431 version. Therefore, the assumption of having a single IPv4 and/or 432 IPv6 value for a nameserver cannot be considered too stringent; 434 o with the exception of handle values, all the sorting properties 435 defined for entity objects can be multivalued according to the 436 definition of vCard as given in RFC6350 [RFC6350]. When more than 437 a value is reported, sorting will be applied to the preferred 438 value identified by the parameter pref="1". If the pref parameter 439 is missing, sorting will be applied to the first value. 441 Each RDAP provider MAY define other sorting properties than those 442 shown in this document. 444 The "jsonPath" field in the "sorting_metadata" element is used to 445 clarify the RDAP field the sorting property refers to. The mapping 446 between the sorting properties and the JSON Paths of the RDAP fields 447 is shown in Table 2. The JSON Paths are provided according to the 448 Goessner v.0.8.0 specification ([GOESSNER-JSON-PATH]): 450 +-------+-------------+---------------------------------------------+ 451 | Objec | Sorting | JSON Path | 452 | t | property | | 453 | class | | | 454 +-------+-------------+---------------------------------------------+ 455 | Searc | registratio | "$.domainSearchResults[*].events[?(@.eventA | 456 | hable | nDate | ction=="registration")].eventDate | 457 | objec | | | 458 | ts | | | 459 | | reregistrat | "$.domainSearchResults[*].events[?(@.eventA | 460 | | ionDate | ction=="reregistration")].eventDate | 461 | | lastChanged | "$.domainSearchResults[*].events[?(@.eventA | 462 | | Date | ction=="lastChanged")].eventDate | 463 | | expirationD | "$.domainSearchResults[*].events[?(@.eventA | 464 | | ate | ction=="expiration")].eventDate | 465 | | deletionDat | "$.domainSearchResults[*].events[?(@.eventA | 466 | | e | ction=="deletion")].eventDate | 467 | | reinstantia | "$.domainSearchResults[*].events[?(@.eventA | 468 | | tionDate | ction=="reinstantiation")].eventDate | 469 | | transferDat | "$.domainSearchResults[*].events[?(@.eventA | 470 | | e | ction=="transfer")].eventDate | 471 | | lockedDate | "$.domainSearchResults[*].events[?(@.eventA | 472 | | | ction=="locked")].eventDate | 473 | | unlockedDat | "$.domainSearchResults[*].events[?(@.eventA | 474 | | e | ction=="unlocked")].eventDate | 475 | | | | 476 | Domai | name | $.domainSearchResults[*].unicodeName | 477 | n | | | 478 | | | | 479 | Names | name | $.nameserverSearchResults[*].unicodeName | 480 | erver | | | 481 | | ipV4 | $.nameserverSearchResults[*].ipAddresses.v4 | 482 | | | [0] | 483 | | ipV6 | $.nameserverSearchResults[*].ipAddresses.v6 | 484 | | | [0] | 485 | | | | 486 | Entit | handle | $.entitySearchResults[*].handle | 487 | y | | | 488 | | fn | $.entitySearchResults[*].vcardArray[1][?(@[ | 489 | | | 0]="fn")][3] | 490 | | org | $.entitySearchResults[*].vcardArray[1][?(@[ | 491 | | | 0]="org")][3] | 492 | | voice | $.entitySearchResults[*].vcardArray[1][?(@[ | 493 | | | 0]=="tel" && @[1].type=="voice")][3] | 494 | | email | $.entitySearchResults[*].vcardArray[1][?(@[ | 495 | | | 0]=="email")][3] | 496 | | country | $.entitySearchResults[*].vcardArray[1][?(@[ | 497 | | | 0]=="adr")][3][6] | 498 | | cc | $.entitySearchResults[*].vcardArray[1][?(@[ | 499 | | | 0]=="adr")][1].cc | 500 | | city | $.entitySearchResults[*].vcardArray[1][?(@[ | 501 | | | 0]=="adr")][3][3] | 502 +-------+-------------+---------------------------------------------+ 504 Table 2: Sorting properties - JSON Path Mapping 506 2.3.2. Representing Sorting Links 508 An RDAP server MAY use the "links" array of the "sorting_metadata" 509 element to provide ready-made references [RFC8288] to the available 510 sort criteria (Figure 4). Each link represents a reference to an 511 alternate view of the results. 513 { 514 "rdapConformance": [ 515 "rdap_level_0", 516 "sorting_level_0" 517 ], 518 ... 519 "sorting_metadata": { 520 "currentSort": "name", 521 "availableSorts": [ 522 { 523 "property": "registrationDate", 524 "jsonPath": "$.domainSearchResults[*] 525 .events[?(@.eventAction==\"registration\")].eventDate", 526 "default": false, 527 "links": [ 528 { 529 "value": "https://example.com/rdap/domains?name=*nr.com 530 &sort=name", 531 "rel": "alternate", 532 "href": "https://example.com/rdap/domains?name=*nr.com 533 &sort=registrationDate", 534 "title": "Result Ascending Sort Link", 535 "type": "application/rdap+json" 536 }, 537 { 538 "value": "https://example.com/rdap/domains?name=*nr.com 539 &sort=name", 540 "rel": "alternate", 541 "href": "https://example.com/rdap/domains?name=*nr.com 542 &sort=registrationDate:d", 543 "title": "Result Descending Sort Link", 544 "type": "application/rdap+json" 545 } 546 ] 547 }, 548 "domainSearchResults": [ 549 ... 550 ] 551 } 553 Figure 4: Example of a "sorting_metadata" instance to implement 554 result sorting 556 2.4. "cursor" Parameter 558 An RDAP query could return a response with hundreds, even thousands, 559 of objects, especially when partial matching is used. For that 560 reason, the cursor parameter addressing result pagination is defined 561 to make responses easier to handle. 563 Presently, the most popular methods to implement pagination in REST 564 API are: offset pagination and keyset pagination. Both two 565 pagination methods don't require the server to handle the result set 566 in a storage area across the requests since a new result set is 567 generated each time a request is submitted. Therefore, they are 568 preferred in comparison to any other method requiring the management 569 of a REST session. 571 Using limit and offset operators represents the traditionally used 572 method to implement results pagination. Both of them can be used 573 individually: 575 o "limit": means that the server must return the first N objects of 576 the result set; 578 o "offset": means that the server must skip the first N objects and 579 must return objects starting from position N+1. 581 When limit and offset are used together, they allow to identify a 582 specific portion of the result set. For example, the pair 583 "offset=100,limit=50" returns first 50 objects starting from position 584 101 of the result set. 586 Despite its easiness of implementation, offset pagination raises some 587 well known drawbacks: 589 o when offset has a very high value, scrolling the result set could 590 take some time; 592 o it always requires to fetch all the rows before dropping as many 593 rows as specified by offset; 595 o it may return inconsistent pages when data are frequently updated 596 (i.e. real-time data) but this doesn't seem the case of 597 registration data. 599 The keyset pagination [SEEK] consists in adding a query condition 600 that enables the seletion of the only data not yet returned. This 601 method has been taken as the basis for the implementation of a 602 "cursor" parameter [CURSOR] by some REST API providers (e.g. 603 [CURSOR-API1],[CURSOR-API2]). The cursor is an opaque URL-safe 604 string representing a logical pointer to the first result of the next 605 page (Figure 5). 607 Nevertheless, even keyset pagination can be troublesome: 609 o it needs at least one key field; 611 o it does not allow to sort just by any field because the sorting 612 criterion must contain a key; 614 o it works best with full composite values support by DBMS (i.e. 615 [x,y]>[a,b]), emulation is possible but ugly and less performant; 617 o it does not allow to directly navigate to arbitrary pages because 618 the result set must be scrolled in sequential order starting from 619 the initial page; 621 o implementing the bi-directional navigation is tedious because all 622 comparison and sort operations have to be reversed. 624 Furthermore, in the RDAP context, some additional considerations can 625 be made: 627 o an RDAP object is a conceptual aggregation of information 628 generally collected from more than one data structure (e.g. table) 629 and this makes even harder for the developers the implementation 630 of the keyset pagination that is already quite difficult. For 631 example, the entity object can gather information from different 632 data structures (registrars, registrants, contacts, resellers, and 633 so on), each one with its own key field mapping the RDAP entity 634 handle; 636 o depending on the number of the page results as well as the number 637 and the complexity of the properties of each RDAP object in the 638 response, the time required by offset pagination to skip the 639 previous pages could be much faster than the processing time 640 needed to build the current page. In fact, RDAP objects are 641 usually formed by information belonging to multiple data 642 structures and containing multivalued properties (i.e. arrays) 643 and, therefore, data selection might be a time consuming process. 644 This situation occurs even though the selection is supported by 645 indexes; 647 o depending on the access levels defined by each RDAP operator, the 648 increase of complexity and the decrease of flexibility of keyset 649 pagination with respect to the offset pagination could be 650 considered impractical. 652 Ultimately, both pagination methods have benefits and drawbacks. 654 That said, the cursor parameter defined in this specification can be 655 used to encode information about any pagination method. For example, 656 in the case of a simple implementation of the cursor parameter to 657 represent offset pagination information, the cursor value 658 "b2Zmc2V0PTEwMCxsaW1pdD01MAo=" is the mere Base64 encoding of 659 "offset=100,limit=50". Likewise, in a simple implementation to 660 represent keyset pagination information, the cursor value 661 "a2V5PXRoZWxhc3Rkb21haW5vZnRoZXBhZ2UuY29t=" represents the mere 662 Base64 encoding of "key=thelastdomainofthepage.com" where the key 663 value identifies the last row of the current page. 665 This solution lets RDAP providers to implement a pagination method 666 according to their needs, the user access levels, the submitted 667 queries. In addition, servers can change the method over time 668 without announcing anything to the clients. 670 The ABNF syntax of the cursor paramter is the following: 672 cursor = "cursor=" 1*( ALPHA / DIGIT / "/" / "=" / "-" / "_" ) 674 https://example.com/rdap/domains?name=*nr.com 675 &cursor=wJlCDLIl6KTWypN7T6vc6nWEmEYe99Hjf1XY1xmqV-M= 677 Figure 5: An example of RDAP query reporting the "cursor" parameter 679 2.4.1. Representing Paging Links 681 An RDAP server SHOULD use the "links" array of the "paging_metadata" 682 element to provide a ready-made reference [RFC8288] to the next page 683 of the result set (Figure 6). Examples of additional "rel" values a 684 server MAY implements are "first", "last", "prev". 686 { 687 "rdapConformance": [ 688 "rdap_level_0", 689 "paging_level_0" 690 ], 691 ... 692 "notices": [ 693 { 694 "title": "Search query limits", 695 "type": "result set truncated due to excessive load", 696 "description": [ 697 "search results for domains are limited to 10" 698 ] 699 } 700 ], 701 "paging_metadata": { 702 "totalCount": 73, 703 "pageCount": 10, 704 "links": [ 705 { 706 "value": "https://example.com/rdap/domains?name=*nr.com", 707 "rel": "next", 708 "href": "https://example.com/rdap/domains?name=*nr.com 709 &cursor=wJlCDLIl6KTWypN7T6vc6nWEmEYe99Hjf1XY1xmqV-M=", 710 "title": "Result Pagination Link", 711 "type": "application/rdap+json" 712 } 713 ] 714 }, 715 "domainSearchResults": [ 716 ... 717 ] 718 } 720 Figure 6: Example of a "paging_metadata" instance to implement cursor 721 pagination 723 3. Negative Answers 725 The value constraints for the parameters are defined by their ABNF 726 syntax. Therefore, each request including an invalid value for a 727 parameter SHOULD obtain an HTTP 400 (Bad Request) response code. The 728 same response SHOULD be returned in the following cases: 730 o if the client provides an unsupported value for the "sort" 731 parameter in both single and multi sort; 733 o if the client submits an invalid value for the "cursor" parameter. 735 Optionally, the response MAY include additional information regarding 736 the negative answer in the HTTP entity body. 738 4. RDAP Conformance 740 Servers returning the "paging_metadata" element in their response 741 MUST include "paging_level_0" in the rdapConformance array as well as 742 servers returning the "sorting_metadata" element MUST include 743 "sorting_level_0". 745 5. Implementation Considerations 747 The implementation of the new parameters is technically feasible, as 748 operators for counting, sorting and paging are currently supported by 749 the major RDBMSs. 751 Similar operators are completely or partially supported by the most 752 known NoSQL databases (MongoDB, CouchDB, HBase, Cassandra, Hadoop) so 753 the implementation of the new parameters seems to be practicable by 754 servers working without the use of an RDBMS. 756 6. Implementation Status 758 NOTE: Please remove this section and the reference to RFC 7942 prior 759 to publication as an RFC. 761 This section records the status of known implementations of the 762 protocol defined by this specification at the time of posting of this 763 Internet-Draft, and is based on a proposal described in RFC 7942 764 [RFC7942]. The description of implementations in this section is 765 intended to assist the IETF in its decision processes in progressing 766 drafts to RFCs. Please note that the listing of any individual 767 implementation here does not imply endorsement by the IETF. 768 Furthermore, no effort has been spent to verify the information 769 presented here that was supplied by IETF contributors. This is not 770 intended as, and must not be construed to be, a catalog of available 771 implementations or their features. Readers are advised to note that 772 other implementations may exist. 774 According to RFC 7942, "this will allow reviewers and working groups 775 to assign due consideration to documents that have the benefit of 776 running code, which may serve as evidence of valuable experimentation 777 and feedback that have made the implemented protocols more mature. 778 It is up to the individual working groups to use this information as 779 they see fit". 781 6.1. IIT-CNR/Registro.it 783 Responsible Organization: Institute of Informatics and Telematics 784 of National Research Council (IIT-CNR)/Registro.it 785 Location: https://rdap.pubtest.nic.it/ 786 Description: This implementation includes support for RDAP queries 787 using data from .it public test environment. 788 Level of Maturity: This is a "proof of concept" research 789 implementation. 790 Coverage: This implementation includes all of the features 791 described in this specification. 792 Contact Information: Mario Loffredo, mario.loffredo@iit.cnr.it 794 6.2. Google Registry 796 Responsible Organization: Google Registry 797 Location: https://www.registry.google/rdap/ 798 Description: This implementation includes support for RDAP queries 799 for TLDs such as .google, .how, .soy, and .xn--q9jyb4c . The RDAP 800 server implements cursor pagination. The link used to request the 801 next page is included in the notice section of the response. 802 Level of Maturity: Production. 803 Coverage: This implementation includes the "cursor" parameter 804 described in this specification. 805 Contact Information: Brian Mountford, mountford@google.com 807 7. IANA Considerations 809 IANA is requested to register the following values in the RDAP 810 Extensions Registry: 812 Extension identifier: paging 813 Registry operator: Any 814 Published specification: This document. 815 Contact: IESG 816 Intended usage: This extension describes a best practice for 817 result set paging. 819 Extension identifier: sorting 820 Registry operator: Any 821 Published specification: This document. 822 Contact: IESG 823 Intended usage: This extension describes a best practice for 824 result set sorting. 826 8. Security Considerations 828 Security services for the operations specified in this document are 829 described in RFC 7481 [RFC7481]. 831 Search query typically requires more server resources (such as 832 memory, CPU cycles, and network bandwidth) when compared to lookup 833 query. This increases the risk of server resource exhaustion and 834 subsequent denial of service due to abuse. This risk can be 835 mitigated by either restricting search functionality and limiting the 836 rate of search requests. Servers can also reduce their load by 837 truncating the results in the response. However, this last security 838 policy can result in a higher inefficiency if the RDAP server does 839 not provide any functionality to return the truncated results. 841 The new parameters presented in this document provide the RDAP 842 operators with a way to implement a secure server without penalizing 843 its efficiency. The "count" parameter gives the user a measure to 844 evaluate the query precision and, at the same time, returns a 845 significant information. The "sort" parameter allows the user to 846 obtain the most relevant information at the beginning of the result 847 set. In both cases, the user doesn't need to submit further 848 unnecessary search requests. Finally, the "cursor" parameter enables 849 the user to scroll the result set by submitting a sequence of 850 sustainable queries according to the server limits. 852 9. Acknowledgements 854 The authors would like to acknowledge Brian Mountford for his 855 contribution to the development of this document. 857 10. References 859 10.1. Normative References 861 [ISO.3166.1988] 862 International Organization for Standardization, "Codes for 863 the representation of names of countries, 3rd edition", 864 ISO Standard 3166, August 1988. 866 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 867 Requirement Levels", BCP 14, RFC 2119, 868 DOI 10.17487/RFC2119, March 1997, 869 . 871 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 872 IANA Considerations Section in RFCs", RFC 5226, 873 DOI 10.17487/RFC5226, May 2008, 874 . 876 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 877 Specifications: ABNF", STD 68, RFC 5234, 878 DOI 10.17487/RFC5234, January 2008, 879 . 881 [RFC5890] Klensin, J., "Internationalized Domain Names for 882 Applications (IDNA): Definitions and Document Framework", 883 RFC 5890, DOI 10.17487/RFC5890, August 2010, 884 . 886 [RFC6350] Perreault, S., "vCard Format Specification", RFC 6350, 887 DOI 10.17487/RFC6350, August 2011, 888 . 890 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 891 Protocol (HTTP/1.1): Message Syntax and Routing", 892 RFC 7230, DOI 10.17487/RFC7230, June 2014, 893 . 895 [RFC7480] Newton, A., Ellacott, B., and N. Kong, "HTTP Usage in the 896 Registration Data Access Protocol (RDAP)", RFC 7480, 897 DOI 10.17487/RFC7480, March 2015, 898 . 900 [RFC7481] Hollenbeck, S. and N. Kong, "Security Services for the 901 Registration Data Access Protocol (RDAP)", RFC 7481, 902 DOI 10.17487/RFC7481, March 2015, 903 . 905 [RFC7482] Newton, A. and S. Hollenbeck, "Registration Data Access 906 Protocol (RDAP) Query Format", RFC 7482, 907 DOI 10.17487/RFC7482, March 2015, 908 . 910 [RFC7483] Newton, A. and S. Hollenbeck, "JSON Responses for the 911 Registration Data Access Protocol (RDAP)", RFC 7483, 912 DOI 10.17487/RFC7483, March 2015, 913 . 915 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 916 Interchange Format", STD 90, RFC 8259, 917 DOI 10.17487/RFC8259, December 2017, 918 . 920 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 921 DOI 10.17487/RFC8288, October 2017, 922 . 924 [RFC8605] Hollenbeck, S. and R. Carney, "vCard Format Extensions: 925 ICANN Extensions for the Registration Data Access Protocol 926 (RDAP)", RFC 8605, DOI 10.17487/RFC8605, May 2019, 927 . 929 10.2. Informative References 931 [CURSOR] Nimesh, R., "Paginating Real-Time Data with Keyset 932 Pagination", July 2014, . 935 [CURSOR-API1] 936 facebook.com, "facebook for developers - Using the Graph 937 API", July 2017, . 940 [CURSOR-API2] 941 twitter.com, "Pagination", 2017, 942 . 945 [GOESSNER-JSON-PATH] 946 Goessner, S., "JSONPath - XPath for JSON", 2007, 947 . 949 [HATEOAS] Jedrzejewski, B., "HATEOAS - a simple explanation", 2018, 950 . 953 [OData-Part1] 954 Pizzo, M., Handl, R., and M. Zurmuehl, "OData Version 4.0. 955 Part 1: Protocol Plus Errata 03", June 2016, 956 . 961 [REST] Fredrich, T., "RESTful Service Best Practices, 962 Recommendations for Creating Web Services", April 2012, 963 . 966 [RFC6901] Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., 967 "JavaScript Object Notation (JSON) Pointer", RFC 6901, 968 DOI 10.17487/RFC6901, April 2013, 969 . 971 [RFC7942] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 972 Code: The Implementation Status Section", BCP 205, 973 RFC 7942, DOI 10.17487/RFC7942, July 2016, 974 . 976 [SEEK] EverSQL.com, "Faster Pagination in Mysql - Why Order By 977 With Limit and Offset is Slow?", July 2017, 978 . 981 [W3C.CR-xpath-31-20161213] 982 Robie, J., Dyck, M., and J. Spiegel, "XML Path Language 983 (XPath) 3.1", World Wide Web Consortium CR CR-xpath- 984 31-20161213, December 2016, 985 . 987 Appendix A. Change Log 989 00: Initial working group version ported from draft-loffredo-regext- 990 rdap-sorting-and-paging-05 991 01: Removed both "offset" and "nextOffset" to keep "paging_metadata" 992 consistent between the pagination methods. Renamed 993 "Considerations about Paging Implementation" section in ""cursor" 994 Parameter". Removed "FOR DISCUSSION" items. Provided a more 995 detailed description of both "sorting_metadata" and 996 "paging_metadata" objects. 997 02: Removed both "offset" and "limit" parameters. Added ABNF syntax 998 of cursor parameter. Rearranged the layout of some sections. 999 Removed some items from "Informative References" section. Changed 1000 "IANA Considerations" section. 1001 03: Added "cc" to the list of sorting properties in "Sorting 1002 Properties Declaration" section. Added RFC8605 to the list of 1003 "Informative References". 1004 04: Replaced "ldhName" with "name" in the "Sorting Properties 1005 Declaration" section. Clarified the sorting logic with respect 1006 the JSON value types and the sorting policy for multivalued 1007 fields. 1009 Authors' Addresses 1010 Mario Loffredo 1011 IIT-CNR/Registro.it 1012 Via Moruzzi,1 1013 Pisa 56124 1014 IT 1016 Email: mario.loffredo@iit.cnr.it 1017 URI: http://www.iit.cnr.it 1019 Maurizio Martinelli 1020 IIT-CNR/Registro.it 1021 Via Moruzzi,1 1022 Pisa 56124 1023 IT 1025 Email: maurizio.martinelli@iit.cnr.it 1026 URI: http://www.iit.cnr.it 1028 Scott Hollenbeck 1029 Verisign Labs 1030 12061 Bluemont Way 1031 Reston, VA 20190 1032 USA 1034 Email: shollenbeck@verisign.com 1035 URI: https://www.verisignlabs.com/