idnits 2.17.1 draft-ietf-regext-rdap-sorting-and-paging-03.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 (June 12, 2019) is 1780 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 476 -- Looks like a reference, but probably isn't: '1' on line 492 -- Looks like a reference, but probably isn't: '3' on line 493 -- Looks like a reference, but probably isn't: '6' on line 489 == Unused Reference: 'RFC5226' is defined on line 854, but no explicit reference was found in the text == Unused Reference: 'RFC8605' is defined on line 902, 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: December 14, 2019 S. Hollenbeck 6 Verisign Labs 7 June 12, 2019 9 Registration Data Access Protocol (RDAP) Query Parameters for Result 10 Sorting and Paging 11 draft-ietf-regext-rdap-sorting-and-paging-03 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 December 14, 2019. 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=ldhName 309 https://example.com/rdap/domains?name=*nr.com&sort=registrationDate:d 311 https://example.com/rdap/domains?name=*nr.com&sort=lockedDate,ldhName 313 Figure 3: Examples of RDAP query reporting the "sort" parameter 315 If the "sort" parameter reports an allowed sorting property, it MUST 316 be provided in the "currentSort" field of the "sorting_metadata" 317 element. 319 2.3.1. Sorting Properties Declaration 321 In the "sort" parameter ABNF syntax, property-ref represents a 322 reference to a property of an RDAP object. Such a reference could be 323 expressed by using a JSON Path. The JSON Path in a JSON document 324 [RFC8259] is equivalent to the XPath [W3C.CR-xpath-31-20161213] in a 325 XML document. For example, the JSON Path to select the value of the 326 ASCII name inside an RDAP domain object is "$.ldhName", where $ 327 identifies the root of the document (DOM). Another way to select a 328 value inside a JSON document is the JSON Pointer [RFC6901]. While 329 JSON Path or JSON Pointer are both standard ways to select any value 330 inside JSON data, neither is particularly easy to use (e.g. 332 "$.events[?(@.eventAction='registration')].eventDate" is the JSON 333 Path expression of the registration date in an RDAP domain object). 335 Therefore, this specification provides a definition of property-ref 336 in terms of RDAP properties. However, not all the RDAP properties 337 are suitable to be used in sort criteria, such as: 339 o properties providing service information (e.g. links, notices, 340 remarks, etc.); 342 o multivalued properties (e.g. status, roles, variants, etc.); 344 o properties modeling relationships to other objects (e.g. 345 entities). 347 On the contrary, some properties expressed as values of other 348 properties (e.g. registration date) could be used in such a context. 350 In the following, a list of properties an RDAP server MAY implement 351 is presented. The properties are divided in two groups: object 352 common properties and object specific properties. 354 o Object common properties. Object common properties are derived 355 from the merge of the "eventAction" and the "eventDate" 356 properties. The following values of the "sort" parameter are 357 defined: 359 * registrationDate 360 * reregistrationDate 361 * lastChangedDate 362 * expirationDate 363 * deletionDate 364 * reinstantiationDate 365 * transferDate 366 * lockedDate 367 * unlockedDate 369 o Object specific properties. With regard to the specific 370 properties, some of them are already defined among the query 371 paths. In the following a list of possible sorting properties, 372 grouped by objects, is shown: 374 * Domain: ldhName 375 * Nameserver: ldhName, ipV4, ipV6. 376 * Entity: fn, handle, org, email, voice, country, cc, city. 378 The correspondence between the sorting properties and the RDAP fields 379 is shown in Table 1: 381 +-----------+-----------+-------------+---------+---------+---------+ 382 | Object | Sorting | RDAP | RFC7483 | RFC6350 | RFC8605 | 383 | class | property | property | | | | 384 +-----------+-----------+-------------+---------+---------+---------+ 385 | Searchabl | Common pr | eventAction | 4.5. | | | 386 | e objects | operties | values | | | | 387 | | | suffixed by | | | | 388 | | | "Date" | | | | 389 | | | | | | | 390 | Domain | ldhName | ldhName | 5.3. | | | 391 | | | | | | | 392 | Nameserve | ldhName | ldhName | 5.2. | | | 393 | r | | | | | | 394 | | ipV4 | v4 | 5.2. | | | 395 | | | ipAddress | | | | 396 | | ipV6 | v6 | 5.2. | | | 397 | | | ipAddress | | | | 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 | 5.1. | 6.4.1 | | 403 | | | with type=" | | | | 404 | | | voice" | | | | 405 | | email | vcard email | 5.1. | 6.4.2 | | 406 | | country | country | 5.1. | 6.3.1 | | 407 | | | name in | | | | 408 | | | vcard adr | | | | 409 | | cc | country | 5.1. | | 3.1 | 410 | | | code in | | | | 411 | | | vcard adr | | | | 412 | | city | locality in | 5.1. | 6.3.1 | | 413 | | | vcard adr | | | | 414 +-----------+-----------+-------------+---------+---------+---------+ 416 Table 1: Sorting properties definition 418 With regard to the definitions in Table 1, some further 419 considerations must be made to disambiguate cases where the RDAP 420 property is multivalued: 422 o even if a nameserver can have multiple IPv4 and IPv6 addresses, 423 the most common configuration includes one address for each IP 424 version. Therefore, the assumption of having a single IPv4 and/or 425 IPv6 value for a nameserver cannot be considered too stringent; 427 o with the exception of handle values, all the sorting properties 428 defined for entity objects can be multivalued according to the 429 definition of vCard as given in RFC6350 [RFC6350]. When more than 430 a value is reported, sorting can be applied to the preferred value 431 identified by the parameter pref="1". 433 Each RDAP provider MAY define other sorting properties than those 434 shown in this document. 436 The "jsonPath" field in the "sorting_metadata" element is used to 437 clarify the RDAP field the sorting property refers to. The mapping 438 between the sorting properties and the JSON Paths of the RDAP fields 439 is shown in Table 2. The JSON Paths are provided according to the 440 Goessner v.0.8.0 specification ([GOESSNER-JSON-PATH]): 442 +-------+-------------+---------------------------------------------+ 443 | Objec | Sorting | JSON Path | 444 | t | property | | 445 | class | | | 446 +-------+-------------+---------------------------------------------+ 447 | Searc | registratio | "$.domainSearchResults[*].events[?(@.eventA | 448 | hable | nDate | ction=="registration")].eventDate | 449 | objec | | | 450 | ts | | | 451 | | reregistrat | "$.domainSearchResults[*].events[?(@.eventA | 452 | | ionDate | ction=="reregistration")].eventDate | 453 | | lastChanged | "$.domainSearchResults[*].events[?(@.eventA | 454 | | Date | ction=="lastChanged")].eventDate | 455 | | expirationD | "$.domainSearchResults[*].events[?(@.eventA | 456 | | ate | ction=="expiration")].eventDate | 457 | | deletionDat | "$.domainSearchResults[*].events[?(@.eventA | 458 | | e | ction=="deletion")].eventDate | 459 | | reinstantia | "$.domainSearchResults[*].events[?(@.eventA | 460 | | tionDate | ction=="reinstantiation")].eventDate | 461 | | transferDat | "$.domainSearchResults[*].events[?(@.eventA | 462 | | e | ction=="transfer")].eventDate | 463 | | lockedDate | "$.domainSearchResults[*].events[?(@.eventA | 464 | | | ction=="locked")].eventDate | 465 | | unlockedDat | "$.domainSearchResults[*].events[?(@.eventA | 466 | | e | ction=="unlocked")].eventDate | 467 | | | | 468 | Domai | ldhName | $.domainSearchResults[*].ldhName | 469 | n | | | 470 | | | | 471 | Names | ldhName | $.nameserverSearchResults[*].ldhName | 472 | erver | | | 473 | | ipV4 | $.nameserverSearchResults[*].ipAddresses.v4 | 474 | | | [0] | 475 | | ipV6 | $.nameserverSearchResults[*].ipAddresses.v6 | 476 | | | [0] | 477 | | | | 478 | Entit | handle | $.entitySearchResults[*].handle | 479 | y | | | 480 | | fn | $.entitySearchResults[*].vcardArray[1][?(@[ | 481 | | | 0]="fn")][3] | 482 | | org | $.entitySearchResults[*].vcardArray[1][?(@[ | 483 | | | 0]="org")][3] | 484 | | voice | $.entitySearchResults[*].vcardArray[1][?(@[ | 485 | | | 0]=="tel" && @[1].type=="voice")][3] | 486 | | email | $.entitySearchResults[*].vcardArray[1][?(@[ | 487 | | | 0]=="email")][3] | 488 | | country | $.entitySearchResults[*].vcardArray[1][?(@[ | 489 | | | 0]=="adr")][3][6] | 490 | | cc | $.entitySearchResults[*].vcardArray[1][?(@[ | 491 | | | 0]=="adr")][1].cc | 492 | | city | $.entitySearchResults[*].vcardArray[1][?(@[ | 493 | | | 0]=="adr")][3][3] | 494 +-------+-------------+---------------------------------------------+ 496 Table 2: Sorting properties - JSON Path Mapping 498 2.3.2. Representing Sorting Links 500 An RDAP server MAY use the "links" array of the "sorting_metadata" 501 element to provide ready-made references [RFC8288] to the available 502 sort criteria (Figure 4). Each link represents a reference to an 503 alternate view of the results. 505 { 506 "rdapConformance": [ 507 "rdap_level_0", 508 "sorting_level_0" 509 ], 510 ... 511 "sorting_metadata": { 512 "currentSort": "ldhName", 513 "availableSorts": [ 514 { 515 "property": "registrationDate", 516 "jsonPath": "$.domainSearchResults[*] 517 .events[?(@.eventAction==\"registration\")].eventDate", 518 "default": false, 519 "links": [ 520 { 521 "value": "https://example.com/rdap/domains?name=*nr.com 522 &sort=ldhName", 523 "rel": "alternate", 524 "href": "https://example.com/rdap/domains?name=*nr.com 525 &sort=registrationDate", 526 "title": "Result Ascending Sort Link", 527 "type": "application/rdap+json" 528 }, 529 { 530 "value": "https://example.com/rdap/domains?name=*nr.com 531 &sort=ldhName", 532 "rel": "alternate", 533 "href": "https://example.com/rdap/domains?name=*nr.com 534 &sort=registrationDate:d", 535 "title": "Result Descending Sort Link", 536 "type": "application/rdap+json" 537 } 538 ] 539 }, 540 "domainSearchResults": [ 541 ... 542 ] 543 } 545 Figure 4: Example of a "sorting_metadata" instance to implement 546 result sorting 548 2.4. "cursor" Parameter 550 An RDAP query could return a response with hundreds, even thousands, 551 of objects, especially when partial matching is used. For that 552 reason, the cursor parameter addressing result pagination is defined 553 to make responses easier to handle. 555 Using limit and offset operators represents the most common way to 556 implement results pagination. Both of them can be used individually: 558 o "limit": means that the server must return the first N objects of 559 the result set; 561 o "offset": means that the server must skip the first N objects and 562 must return objects starting from position N+1. 564 When limit and offset are used together, they allow to identify a 565 specific portion of the result set. For example, the pair 566 "offset=100,limit=50" returns first 50 objects starting from position 567 101 of the result set. 569 However, offset pagination raises some well known drawbacks: 571 o when offset has a very high value, scrolling the result set could 572 take some time; 574 o it always requires to fetch all the rows before dropping as many 575 rows as specified by offset; 577 o it may return inconsistent pages when data are frequently updated 578 (i.e. real-time data) but this doesn't seem the case of 579 registration data. 581 An alternative approach to offset pagination is keyset pagination 582 [SEEK] which consists in adding a query condition that enables the 583 seletion of the only data not yet returned. This method has been 584 taken as the basis for the implementation of a "cursor" parameter 585 [CURSOR] by some REST API providers (e.g. 586 [CURSOR-API1],[CURSOR-API2]). The cursor is an opaque URL-safe 587 string representing a logical pointer to the first result of the next 588 page (Figure 5). Basically, the cursor is the encryption of the key 589 value identifying the last row of the current page. For example, the 590 cursor value "a2V5PXRoZWxhc3Rkb21haW5vZnRoZXBhZ2UuY29t=" is the mere 591 Base64 encoding of "key=thelastdomainofthepage.com". 593 The ABNF syntax is the following: 595 cursor = "cursor=" ( ALPHA / DIGIT / "/" / "=" / "-" / "_" ) 597 https://example.com/rdap/domains?name=*nr.com 598 &cursor=wJlCDLIl6KTWypN7T6vc6nWEmEYe99Hjf1XY1xmqV-M= 600 Figure 5: An example of RDAP query reporting the "cursor" parameter 602 Nevertheless, even cursor pagination can be troublesome: 604 o it needs at least one key field; 606 o it does not allow to sort just by any field because the sorting 607 criterion must contain a key; 609 o it works best with full composite values support by DBMS (i.e. 610 [x,y]>[a,b]), emulation is possible but ugly and less performant; 612 o it does not allow to directly navigate to arbitrary pages because 613 the result set must be scrolled in sequential order starting from 614 the initial page; 616 o implementing the bi-directional navigation is tedious because all 617 comparison and sort operations have to be reversed. 619 Furthermore, in the RDAP context, some additional considerations can 620 be made: 622 o an RDAP object is a conceptual aggregation of information 623 generally collected from more than one data structure (e.g. table) 624 and this makes even harder for the developers the implementation 625 of the keyset pagination that is already quite difficult. For 626 example, the entity object can gather information from different 627 data structures (registrars, registrants, contacts, resellers, and 628 so on), each one with its own key field mapping the RDAP entity 629 handle; 631 o depending on the number of the page results as well as the number 632 and the complexity of the properties of each RDAP object in the 633 response, the time required by offset pagination to skip the 634 previous pages could be much faster than the processing time 635 needed to build the current page. In fact, RDAP objects are 636 usually formed by information belonging to multiple data 637 structures and containing multivalued properties (i.e. arrays) 638 and, therefore, data selection might be a time consuming process. 639 This situation occurs even though the selection is supported by 640 indexes; 642 o depending on the access levels defined by each RDAP operator, the 643 increase of complexity and the decrease of flexibility of cursor 644 pagination with respect to the offset pagination could be 645 considered impractical. 647 Ultimately, both pagination methods have benefits and drawbacks. 648 That said, the cursor parameter can be used to encode not only the 649 key value but also the information about offset pagination. For 650 example, the cursor value "b2Zmc2V0PTEwMCxsaW1pdD01MAo=" is the mere 651 Base64 encoding of "offset=100,limit=50". This solution lets RDAP 652 providers to implement a pagination method according to their needs, 653 the user access levels, the submitted queries. In addition, servers 654 can change the method over time without announcing anything to the 655 clients. 657 2.4.1. Representing Paging Links 659 An RDAP server SHOULD use the "links" array of the "paging_metadata" 660 element to provide a ready-made reference [RFC8288] to the next page 661 of the result set (Figure 6). Examples of additional "rel" values a 662 server MAY implements are "first", "last", "prev". 664 { 665 "rdapConformance": [ 666 "rdap_level_0", 667 "paging_level_0" 668 ], 669 ... 670 "notices": [ 671 { 672 "title": "Search query limits", 673 "type": "result set truncated due to excessive load", 674 "description": [ 675 "search results for domains are limited to 10" 676 ] 677 } 678 ], 679 "paging_metadata": { 680 "totalCount": 73, 681 "pageCount": 10, 682 "links": [ 683 { 684 "value": "https://example.com/rdap/domains?name=*nr.com", 685 "rel": "next", 686 "href": "https://example.com/rdap/domains?name=*nr.com 687 &cursor=wJlCDLIl6KTWypN7T6vc6nWEmEYe99Hjf1XY1xmqV-M=", 688 "title": "Result Pagination Link", 689 "type": "application/rdap+json" 690 } 691 ] 692 }, 693 "domainSearchResults": [ 694 ... 695 ] 696 } 698 Figure 6: Example of a "paging_metadata" instance to implement cursor 699 pagination 701 3. Negative Answers 703 The value constraints for the parameters are defined by their ABNF 704 syntax. Therefore, each request including an invalid value for a 705 parameter SHOULD obtain an HTTP 400 (Bad Request) response code. The 706 same response SHOULD be returned in the following cases: 708 o if the client provides an unsupported value for the "sort" 709 parameter in both single and multi sort; 711 o if the client submits an invalid value for the "cursor" parameter. 713 Optionally, the response MAY include additional information regarding 714 the negative answer in the HTTP entity body. 716 4. RDAP Conformance 718 Servers returning the "paging_metadata" element in their response 719 MUST include "paging_level_0" in the rdapConformance array as well as 720 servers returning the "sorting_metadata" element MUST include 721 "sorting_level_0". 723 5. Implementation Considerations 725 The implementation of the new parameters is technically feasible, as 726 operators for counting, sorting and paging are currently supported by 727 the major RDBMSs. 729 Similar operators are completely or partially supported by the most 730 known NoSQL databases (MongoDB, CouchDB, HBase, Cassandra, Hadoop) so 731 the implementation of the new parameters seems to be practicable by 732 servers working without the use of an RDBMS. 734 Furthermore, both two pagination methods don't require the server to 735 handle the result set in a storage area across the requests since a 736 new result set is generated each time a request is submitted. 738 6. Implementation Status 740 NOTE: Please remove this section and the reference to RFC 7942 prior 741 to publication as an RFC. 743 This section records the status of known implementations of the 744 protocol defined by this specification at the time of posting of this 745 Internet-Draft, and is based on a proposal described in RFC 7942 746 [RFC7942]. The description of implementations in this section is 747 intended to assist the IETF in its decision processes in progressing 748 drafts to RFCs. Please note that the listing of any individual 749 implementation here does not imply endorsement by the IETF. 750 Furthermore, no effort has been spent to verify the information 751 presented here that was supplied by IETF contributors. This is not 752 intended as, and must not be construed to be, a catalog of available 753 implementations or their features. Readers are advised to note that 754 other implementations may exist. 756 According to RFC 7942, "this will allow reviewers and working groups 757 to assign due consideration to documents that have the benefit of 758 running code, which may serve as evidence of valuable experimentation 759 and feedback that have made the implemented protocols more mature. 761 It is up to the individual working groups to use this information as 762 they see fit". 764 6.1. IIT-CNR/Registro.it 766 Responsible Organization: Institute of Informatics and Telematics 767 of National Research Council (IIT-CNR)/Registro.it 768 Location: https://rdap.pubtest.nic.it/ 769 Description: This implementation includes support for RDAP queries 770 using data from .it public test environment. 771 Level of Maturity: This is a "proof of concept" research 772 implementation. 773 Coverage: This implementation includes all of the features 774 described in this specification. 775 Contact Information: Mario Loffredo, mario.loffredo@iit.cnr.it 777 6.2. Google Registry 779 Responsible Organization: Google Registry 780 Location: https://www.registry.google/rdap/ 781 Description: This implementation includes support for RDAP queries 782 for TLDs such as .google, .how, .soy, and .xn--q9jyb4c . The RDAP 783 server implements cursor pagination. The link used to request the 784 next page is included in the notice section of the response. 785 Level of Maturity: Production. 786 Coverage: This implementation includes the "cursor" parameter 787 described in this specification. 788 Contact Information: Brian Mountford, mountford@google.com 790 7. IANA Considerations 792 IANA is requested to register the following values in the RDAP 793 Extensions Registry: 795 Extension identifier: paging 796 Registry operator: Any 797 Published specification: This document. 798 Contact: IESG 799 Intended usage: This extension describes a best practice for 800 result set paging. 802 Extension identifier: sorting 803 Registry operator: Any 804 Published specification: This document. 805 Contact: IESG 806 Intended usage: This extension describes a best practice for 807 result set sorting. 809 8. Security Considerations 811 Security services for the operations specified in this document are 812 described in RFC 7481 [RFC7481]. 814 Search query typically requires more server resources (such as 815 memory, CPU cycles, and network bandwidth) when compared to lookup 816 query. This increases the risk of server resource exhaustion and 817 subsequent denial of service due to abuse. This risk can be 818 mitigated by either restricting search functionality and limiting the 819 rate of search requests. Servers can also reduce their load by 820 truncating the results in the response. However, this last security 821 policy can result in a higher inefficiency if the RDAP server does 822 not provide any functionality to return the truncated results. 824 The new parameters presented in this document provide the RDAP 825 operators with a way to implement a secure server without penalizing 826 its efficiency. The "count" parameter gives the user a measure to 827 evaluate the query precision and, at the same time, returns a 828 significant information. The "sort" parameter allows the user to 829 obtain the most relevant information at the beginning of the result 830 set. In both cases, the user doesn't need to submit further 831 unnecessary search requests. Finally, the "cursor" parameter enables 832 the user to scroll the result set by submitting a sequence of 833 sustainable queries according to the server limits. 835 9. Acknowledgements 837 The authors would like to acknowledge Brian Mountford for his 838 contribution to the development of this document. 840 10. References 842 10.1. Normative References 844 [ISO.3166.1988] 845 International Organization for Standardization, "Codes for 846 the representation of names of countries, 3rd edition", 847 ISO Standard 3166, August 1988. 849 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 850 Requirement Levels", BCP 14, RFC 2119, 851 DOI 10.17487/RFC2119, March 1997, 852 . 854 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 855 IANA Considerations Section in RFCs", RFC 5226, 856 DOI 10.17487/RFC5226, May 2008, 857 . 859 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 860 Specifications: ABNF", STD 68, RFC 5234, 861 DOI 10.17487/RFC5234, January 2008, 862 . 864 [RFC6350] Perreault, S., "vCard Format Specification", RFC 6350, 865 DOI 10.17487/RFC6350, August 2011, 866 . 868 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 869 Protocol (HTTP/1.1): Message Syntax and Routing", 870 RFC 7230, DOI 10.17487/RFC7230, June 2014, 871 . 873 [RFC7480] Newton, A., Ellacott, B., and N. Kong, "HTTP Usage in the 874 Registration Data Access Protocol (RDAP)", RFC 7480, 875 DOI 10.17487/RFC7480, March 2015, 876 . 878 [RFC7481] Hollenbeck, S. and N. Kong, "Security Services for the 879 Registration Data Access Protocol (RDAP)", RFC 7481, 880 DOI 10.17487/RFC7481, March 2015, 881 . 883 [RFC7482] Newton, A. and S. Hollenbeck, "Registration Data Access 884 Protocol (RDAP) Query Format", RFC 7482, 885 DOI 10.17487/RFC7482, March 2015, 886 . 888 [RFC7483] Newton, A. and S. Hollenbeck, "JSON Responses for the 889 Registration Data Access Protocol (RDAP)", RFC 7483, 890 DOI 10.17487/RFC7483, March 2015, 891 . 893 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 894 Interchange Format", STD 90, RFC 8259, 895 DOI 10.17487/RFC8259, December 2017, 896 . 898 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 899 DOI 10.17487/RFC8288, October 2017, 900 . 902 [RFC8605] Hollenbeck, S. and R. Carney, "vCard Format Extensions: 903 ICANN Extensions for the Registration Data Access Protocol 904 (RDAP)", RFC 8605, DOI 10.17487/RFC8605, May 2019, 905 . 907 10.2. Informative References 909 [CURSOR] Nimesh, R., "Paginating Real-Time Data with Keyset 910 Pagination", July 2014, . 913 [CURSOR-API1] 914 facebook.com, "facebook for developers - Using the Graph 915 API", July 2017, . 918 [CURSOR-API2] 919 twitter.com, "Pagination", 2017, 920 . 923 [GOESSNER-JSON-PATH] 924 Goessner, S., "JSONPath - XPath for JSON", 2007, 925 . 927 [HATEOAS] Jedrzejewski, B., "HATEOAS - a simple explanation", 2018, 928 . 931 [OData-Part1] 932 Pizzo, M., Handl, R., and M. Zurmuehl, "OData Version 4.0. 933 Part 1: Protocol Plus Errata 03", June 2016, 934 . 939 [REST] Fredrich, T., "RESTful Service Best Practices, 940 Recommendations for Creating Web Services", April 2012, 941 . 944 [RFC6901] Bryan, P., Ed., Zyp, K., and M. Nottingham, Ed., 945 "JavaScript Object Notation (JSON) Pointer", RFC 6901, 946 DOI 10.17487/RFC6901, April 2013, 947 . 949 [RFC7942] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 950 Code: The Implementation Status Section", BCP 205, 951 RFC 7942, DOI 10.17487/RFC7942, July 2016, 952 . 954 [SEEK] EverSQL.com, "Faster Pagination in Mysql - Why Order By 955 With Limit and Offset is Slow?", July 2017, 956 . 959 [W3C.CR-xpath-31-20161213] 960 Robie, J., Dyck, M., and J. Spiegel, "XML Path Language 961 (XPath) 3.1", World Wide Web Consortium CR CR-xpath- 962 31-20161213, December 2016, 963 . 965 Appendix A. Change Log 967 00: Initial working group version ported from draft-loffredo-regext- 968 rdap-sorting-and-paging-05 969 01: Removed both "offset" and "nextOffset" to keep "paging_metadata" 970 consistent between the pagination methods. Renamed 971 "Considerations about Paging Implementation" section in ""cursor" 972 Parameter". Removed "FOR DISCUSSION" items. Provided a more 973 detailed description of both "sorting_metadata" and 974 "paging_metadata" objects. 975 02: Removed both "offset" and "limit" parameters. Added ABNF syntax 976 of cursor parameter. Rearranged the layout of some sections. 977 Removed some items from "Informative References" section. Changed 978 "IANA Considerations" section. 979 03: Added "cc" to the list of sorting properties in "Sorting 980 Properties Declaration" section. Added RFC8605 to the list of 981 "Informative References". 983 Authors' Addresses 985 Mario Loffredo 986 IIT-CNR/Registro.it 987 Via Moruzzi,1 988 Pisa 56124 989 IT 991 Email: mario.loffredo@iit.cnr.it 992 URI: http://www.iit.cnr.it 993 Maurizio Martinelli 994 IIT-CNR/Registro.it 995 Via Moruzzi,1 996 Pisa 56124 997 IT 999 Email: maurizio.martinelli@iit.cnr.it 1000 URI: http://www.iit.cnr.it 1002 Scott Hollenbeck 1003 Verisign Labs 1004 12061 Bluemont Way 1005 Reston, VA 20190 1006 USA 1008 Email: shollenbeck@verisign.com 1009 URI: https://www.verisignlabs.com/