Network Working Group A. Newton Internet-Draft ARIN Intended status: Standards Track K. Ranjbar Expires: November 11, 2012 RIPE NCC A. Servin LACNIC B. Ellacott APNIC S. Hollenbeck Verisign S. Sheng F. Arias ICANN N. Kong CNNIC F. Obispo ISC May 10, 2012 Using HTTP for RESTful Whois Services by Internet Registries draft-designteam-weirds-using-http-00 Abstract This document describes the use of HTTP in Whois services using RESTful web methodologies. Status of this Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at http://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on November 11, 2012. Copyright Notice Copyright (c) 2012 IETF Trust and the persons identified as the Newton, et al. Expires November 11, 2012 [Page 1] Internet-Draft HTTP for RESTful Whois May 2012 document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 3. Design Intents . . . . . . . . . . . . . . . . . . . . . . . . 6 4. Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.1. Accept Header . . . . . . . . . . . . . . . . . . . . . . 7 4.2. Parameters . . . . . . . . . . . . . . . . . . . . . . . . 7 5. Types of HTTP Response . . . . . . . . . . . . . . . . . . . . 8 5.1. Positive Answers . . . . . . . . . . . . . . . . . . . . . 8 5.2. Redirects . . . . . . . . . . . . . . . . . . . . . . . . 8 5.3. Negative Answers . . . . . . . . . . . . . . . . . . . . . 8 5.4. Malformed Queries . . . . . . . . . . . . . . . . . . . . 8 6. Use of JSON . . . . . . . . . . . . . . . . . . . . . . . . . 9 6.1. Signaling . . . . . . . . . . . . . . . . . . . . . . . . 9 6.2. Naming . . . . . . . . . . . . . . . . . . . . . . . . . . 9 7. Use of XML . . . . . . . . . . . . . . . . . . . . . . . . . . 10 7.1. Signaling . . . . . . . . . . . . . . . . . . . . . . . . 10 7.2. Naming and Structure . . . . . . . . . . . . . . . . . . . 10 8. Common Error Response Body . . . . . . . . . . . . . . . . . . 12 9. Common Datatypes . . . . . . . . . . . . . . . . . . . . . . . 13 10. Internationalization Considerations . . . . . . . . . . . . . 14 10.1. URIs vs IRIs . . . . . . . . . . . . . . . . . . . . . . . 14 10.2. Character Encoding . . . . . . . . . . . . . . . . . . . . 14 11. Normative References . . . . . . . . . . . . . . . . . . . . . 15 Appendix A. Areas of Improvement . . . . . . . . . . . . . . . . 16 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 17 Newton, et al. Expires November 11, 2012 [Page 2] Internet-Draft HTTP for RESTful Whois May 2012 1. Introduction Over time, several deficiencies have been noted in the Whois protocol as described in RFC 3912. The following is a partial list: lack of standardized command structures lack of standardized output and error structures lack of support for internationalization (and therefore localization) lack of support for user identification, authentication, and access control This document describes the usage of HTTP for Internet registry Whois services running on RESTful web servers for the purposes of addressing the deficiencies as described above. The goal of this document is to tie together the usage patterns of HTTP into a common profile applicable to the various types of Internet registries serving Whois data using RESTful styling. By giving the various Internet registries a common behavior, a single client is better able to retreive data from Internet registries adhering to this behavior. The goal of this specification is to define a simple use of HTTP to deliver Whois information using RESTful patterns. Where complexity may reside, it is the goal of this specification to place it upon the server and to keep the client as simple as possible. In the vacubulary of computer programmers, it should be suffecient enough to write a client for this application in bash using commands such as wget or curl and other commonly available command line tools. This is the basic usage pattern for this protocol: 1. A client issues an HTTP query using GET. As an example, a query for the network registration 192.168.0.0 might be http://example.com/ip/192.168.0.0. 2. If the receiving server has the information for the query, it examines the Accept header of the query and returns a 200 response with a response entity appropriate for the requested format. 3. If the receiving server does not have the information for the query but does have knowledge of where the information can be found, it will return a response of 301 or 303 with the Redirect header containing an HTTP URL pointing to the information. The client is expected to re-query using that HTTP URL. Newton, et al. Expires November 11, 2012 [Page 3] Internet-Draft HTTP for RESTful Whois May 2012 4. If the receiving server does not have the information being requested and does not have knowledge of where the information can be found, it should return a 404 response. It is important to note that it is not the intent of this document to redefine the meaning and semantics of HTTP. The purpose of this document is to clarify the use of standard HTTP mechanisms for this application. Newton, et al. Expires November 11, 2012 [Page 4] Internet-Draft HTTP for RESTful Whois May 2012 2. Terminology As is noted in SSAC Report on WHOIS Terminology and Structure [SAC-051], the term "Whois" is overloaded, often referring to a protocol, a service and data. In accordance with [SAC-051], this document describes the base behavior for a Registration Data Access Protocol (RD-AP). At present, there are two known types of RD-AP, a Domain Name Registration Data Access Protocol (DNRD-AP) and a Number Resource Registration Data Access Protocol (NRRD-AP). Both the DNRD-AP and NRRD-AP are to be built upon this base behavior, the RD-AP. Note that other types of RD-AP may exist in the future. Newton, et al. Expires November 11, 2012 [Page 5] Internet-Draft HTTP for RESTful Whois May 2012 3. Design Intents There are a few design criteria this document attempts to support. First, each query is meant to return either zero or one result. With the maximum upper bound being set to one, the issuance of redirects is simplified to the known document model used by HTTP [RFC2616]. Should a result contain more than one result, some of which are better served by other servers, the redirection model becomes much more complicated. Second, multiple response formats are supported by this protocol. This document outlines the base usage of JSON and XML, but server operators may support other formats as they desire if appropriate. Third, HTTP offers a number of transport protocol mechanisms not described further in this document. Operators are able to make use of these mechanisms according to their local policy, including cache control, authorization, compression, and redirection. HTTP also benefits from widespread investment in scalability, reliability, and performance Newton, et al. Expires November 11, 2012 [Page 6] Internet-Draft HTTP for RESTful Whois May 2012 4. Queries 4.1. Accept Header Clients SHOULD put the MIME type of the format they desire in the Accept header. Servers SHOULD respond with an appropriate MIME type in the Accept header in accordance with the preference rules for the Accept header in HTTP [RFC2616]. However the use by clients of multiple MIME types in the Accept header is NOT RECOMMENDED. Clients may use a generic MIME type for the desired data format of the response, but servers MUST respond with the most appropriate MIME type. In other words, a client may use "application\json" to express that it desires JSON or "application\weirds_blah_v1+json" to express that it desires WEIRDS BLAH version 1 in JSON. The server MUST respond with "application\weirds_blah_v1+json". 4.2. Parameters To overcome issues with misbehaving HTTP [RFC2616] cache infrastructure, clients may use the '__weirds__cachebust' query parameter with a random value of their choosing. Servers MUST ignore this query parameter. The following is an example use of this parameter to retreive the abuse contacts associated with the most specific IP network with the address 192.0.2.0: /ip/192.0.2.0/operator/contacts/abuse?__weirds_cachebust=xyz123 For all others, servers SHOULD ignore unknown query parameters. Newton, et al. Expires November 11, 2012 [Page 7] Internet-Draft HTTP for RESTful Whois May 2012 5. Types of HTTP Response This section describes the various types of responses a server may send to a client. While no standard HTTP response code is forbidden in usage, at a minimum clients should understand the response codes described in this section. It is expected that usage of response codes and types for this application not defined here will be described in subsequent documents. 5.1. Positive Answers If a server has the information requested by the client and wishes to respond to the client with the information according to its policies, it should encode the answer in the format most appropriate according to the standard and defined rules for processing the HTTP Accept header, and return that answer in the body of a 200 response. 5.2. Redirects If a server wishes to inform a client that the answer to a given query can be found elsewhere, it should return either a 301 or a 303 reponse code and an HTTP URL in the Redirect header. The client is expected to issue a subsequent query using the given URL without any processing of the URL. In other words, the server is to hand back a complete URL and the client should not have to transform the URL to follow it. A server should use a 301 response to inform the client of a permanent move and a 303 repsonse otherwise. For this application, such an example of a permentant move might be a TLD operator informing a client the information being sought can be found with another TLD operator (i.e. a query for the domain bar in foo.example is found at http://foo.example/domain/bar). 5.3. Negative Answers If a server wishes to respond that it has no information regarding the query, it SHOULD return a 404 response code. Optionally, it may include additional information regarding the lack of information as defined by Section 8. 5.4. Malformed Queries If a server receives a query which it cannot understand, it SHOULD return a 503 response code. Optionally, it may include additional information about why it does not understand the query as defined by Section 8. Newton, et al. Expires November 11, 2012 [Page 8] Internet-Draft HTTP for RESTful Whois May 2012 6. Use of JSON 6.1. Signaling Clients may signal their desire for JSON using the "application\json" mime type or a more application specific JSON mime type. 6.2. Naming Clients processing JSON [RFC4627] responses SHOULD ignore values associated with unrecognized names. Servers MAY insert values signified by names into the JSON responses which are not specified in this document. Insertion of unspecified values into JSON responses SHOULD have names prefixed with a short identifier followed by an underscore followed by a meaningful name. For example, "handle" may be specified as the name of a value which is a string containing a registry unique identifier for a registration. The registry of the Moon might desire to insert a value specific to their services denoting that a registration occured before or after the first moon landing. The name for such a value might take the form "lunarNic_beforeOneSmallStep". JSON names SHOULD only consist of the alphabetic ASCII characters A through Z in both uppercase and lowercase, underscore characters, and SHOULD NOT begin with an underscore character or the characters "xml". This restriction is a union of the Ruby programming language identifier syntax and the XML element name syntax and has two purposes. First, client implementers using modern programming languages such as Ruby or Java may use libraries that automatically promote JSON values to first order object attributes or members (e.g. using the example above, the values may be referenced as network.handle or network.lunarNic_beforeOneSmallStep). Second, a clean mapping between JSON and XML is easy to accomplish using the JSON representation. Clients processing JSON responses MUST be prepared for values specified in the registry response documents to be absent from a response as no JSON value listed is required to appear in the response. In other words, servers MAY remove values as is needed by the policies of the server operator. Newton, et al. Expires November 11, 2012 [Page 9] Internet-Draft HTTP for RESTful Whois May 2012 7. Use of XML 7.1. Signaling Clients may signal their desire for XML using the "application\xml" mime type or a more application specific XML mime type. 7.2. Naming and Structure Well-formed XML may be programmatically produced using the JSON encodings due to the JSON naming rules outlined in Section 6.2 and the following simple rules: 1. Where a JSON name is given, the corresponding XML element has the same name. 2. Where a JSON value is found, it is the content of the corresponding XML element. 3. Where a JSON value is an array, the XML element is to be repeated for each element of the array. 4. The root tag of the XML document is to be "response". Consider the following JSON response. { "startAddress" : "10.0.0.0", "endAddress" : "10.0.0.255", "remarks" : [ "she sells seas shells", "down by the seashore" ], "uris" : [ { "type" : "source", "uri" : "http://whois-rws.net/network/xxxx" }, { "type" : "parent", "uri" : "http://whois-rws.net/network/yyyy" } } Figure 1 Newton, et al. Expires November 11, 2012 [Page 10] Internet-Draft HTTP for RESTful Whois May 2012 The corresponding XML would look like this: 10.0.0.0 10.0.0.255 She sells sea shells down by the seashore source http://whois-rws.net/network/xxxx parent http://whois-rws.net/network/yyyy The rules for clients processing XML responses are the same as those with JSON: clients SHOULD ignore unrecognized XML elements, and servers MAY insert XML elements with tag names according to the naming rules in Section 6.2. And as with JSON, clients MUST be prepared for XML elements specified in the registry response documents to be absent from a response as no XML element listed is required to appear in the response. Newton, et al. Expires November 11, 2012 [Page 11] Internet-Draft HTTP for RESTful Whois May 2012 8. Common Error Response Body As specified in Section 5, some non-answer responses may return entity bodies with information that could be more descriptive. The basic structure of that response is a data class containing an error code number (corresponding to the HTTP response code) followed by a string named "title" followed by an array of strings named "description". This is an example of the JSON version of the common response body. { "errorCode": 418 "title": "No More Tacos", "description": [ "We ran out of shells and sauce.", "Come back tomorrow." ] } Figure 2 This is an example of the XML version of the common response body. 418 No More Tacos We ran out of shells and sauce. Come back tomorrow. Figure 3 The MIME type for the JSON structure is "application\weirds_common_error_v1+json" and the MIME type for the XML document is "application\weirds_common_error_v1+xml". A client MAY simply use the HTTP response code as the server is not required to include error data in the response body. However, if a client wishes to parse the error data, it SHOULD first check that the Accept header contains the appropriate MIME type. Newton, et al. Expires November 11, 2012 [Page 12] Internet-Draft HTTP for RESTful Whois May 2012 9. Common Datatypes This section describes common data types found in Internet registries. Unless otherwise stated by the response specification of an Internet registry using this specification as a basis, the data types can assume to be as follows: 1. IPv4 addresses - [RFC0791] 2. IPv6 addresses - [RFC5952] 3. country code - [ISO.3166.1988] 4. domain name - [RFC4343] 5. email address - [RFC5322] 6. date and time strings - [RFC3339] Newton, et al. Expires November 11, 2012 [Page 13] Internet-Draft HTTP for RESTful Whois May 2012 10. Internationalization Considerations 10.1. URIs vs IRIs Clients MAY use IRIs as they see fit, but MUST transform them to URIs [RFC3986] for interaction with RD-AP servers. RD-AP servers MUST use URIs in all responses, and clients MAY transform these URIs to IRIs. 10.2. Character Encoding The default text encoding for JSON and XML responses in RD-AP is UTF-8, and all servers and clients MUST support UTF-8. Servers and clients MAY optionally support other character encodings. Newton, et al. Expires November 11, 2012 [Page 14] Internet-Draft HTTP for RESTful Whois May 2012 11. Normative References [SAC-051] Piscitello, D., Ed., "SSAC Report on Domain Name WHOIS Terminology and Structure", September 2011. [RFC4627] Crockford, D., "The application/json Media Type for JavaScript Object Notation (JSON)", RFC 4627, July 2006. [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the Internet: Timestamps", RFC 3339, July 2002. [RFC4034] Arends, R., Austein, R., Larson, M., Massey, D., and S. Rose, "Resource Records for the DNS Security Extensions", RFC 4034, March 2005. [RFC0791] Postel, J., "Internet Protocol", STD 5, RFC 791, September 1981. [RFC5952] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 Address Text Representation", RFC 5952, August 2010. [ISO.3166.1988] International Organization for Standardization, "Codes for the representation of names of countries, 3rd edition", ISO Standard 3166, August 1988. [RFC5396] Huston, G. and G. Michaelson, "Textual Representation of Autonomous System (AS) Numbers", RFC 5396, December 2008. [RFC4343] Eastlake, D., "Domain Name System (DNS) Case Insensitivity Clarification", RFC 4343, January 2006. [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005. [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322, October 2008. [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. Newton, et al. Expires November 11, 2012 [Page 15] Internet-Draft HTTP for RESTful Whois May 2012 Appendix A. Areas of Improvement Things that need to be done to this draft. 1. authentication what? 2. clean up must should, ref 2119? 3. better language on data formats... it was just a rough start 4. IANA considerations 5. Security considerations? 6. Is there a privacy considerations things we have to do now? Newton, et al. Expires November 11, 2012 [Page 16] Internet-Draft HTTP for RESTful Whois May 2012 Authors' Addresses Andrew Lee Newton American Registry for Internet Numbers 3635 Concorde Parkway Chantilly, VA 20151 US Email: andy@arin.net URI: http://www.arin.net Kaveh Ranjbar RIPE Network Coordination Centre Singel 258 Amsterdam 1016AB NL Email: kranjbar@ripe.net URI: http://www.ripe.net Arturo L. Servin Latin American and Caribbean Internet Address Registry Rambla Republica de Mexico 6125 Montevideo 11300 UY Email: aservin@lacnic.net URI: http://www.lacnic.net Byron J. Ellacott Asia Pacific Network Information Center 6 Cordelia Street South Brisbane QLD 4101 Australia Email: bje@apnic.net URI: http://www.apnic.net Newton, et al. Expires November 11, 2012 [Page 17] Internet-Draft HTTP for RESTful Whois May 2012 Scott Hollenbeck Verisign Labs 12061 Bluemont Way Reston, VA 20190 US Email: shollenbeck@verisign.com URI: http://www.verisignlabs.com/ Steve Sheng Internet Corporation for Assigned Names and Numbers 4676 Admiralty Way, Suite 330 Marina del Rey, CA 90292 United States of America Phone: +1.310.823.9358 Email: steve.sheng@icann.org Francisco Arias Internet Corporation for Assigned Names and Numbers 4676 Admiralty Way, Suite 330 Marina del Rey, CA 90292 United States of America Phone: +1.310.823.9358 Email: francisco.arias@icann.org Ning Kong China Internet Network Information Center 4 South 4th Street, Zhongguancun, Haidian District Beijing 100190 China Phone: +86 10 5881 3147 Email: nkong@cnnic.cn Newton, et al. Expires November 11, 2012 [Page 18] Internet-Draft HTTP for RESTful Whois May 2012 Francisco Obispo Internet Systems Consortium 950 Charter St Redwood City, CA 94063 United States of America Phone: +1.650.423.1374 Email: fobispo@isc.org Newton, et al. Expires November 11, 2012 [Page 19]