Web InterFace Language

Introduction

The Web InterFace Language (WIFL) addresses the description of a web application with RESTful APIs. Its goal is to cover common idioms of RESTful APIs and is intended to be used in the annotation of HTML with RDFa. This document contains a detailed description of the model, including the object and datatype classes. The description is marked up with RDFa using the RDF schema vocabulary.

For a comparison of WIFL and WADL, see WIFL is not WADL.

Object Classes

The WIFL object classes may have associations with other object classes and attributes whose types are attribute classes. The object classes and their associations and attributes are shown in the UML class diagrams below.

Object Classes
ClassSummary
Example
An example of an HTTP message exchange.
ExampleHeader
An example HTTP header.
ExampleRequest
An example HTTP request.
ExampleResponse
An example HTTP response.
Parameter
A request or response parameter.
Parameterized
The abstract base class of all classes that may have parameters.
Representation
A resource's representation.
Request
A request to a resource.
Resource
A collection of a resource's sub-resources, requests and their common parameters.
Response
A response to a request.

Example

An example of an HTTP message exchange.
    Associations
    NameClassMultiplicityDescription
    exampleRequestExampleRequest*
    An example request.
    exampleResponseExampleResponse*
    An example response.
    seeAlsoThing*
    The URI of a related resource.

    ExampleHeader

    An example HTTP header.
      Attributes
      NameClassArityDescription
      namefieldName1
      The header's name.
      valuefieldValue1
      The header's value.

      ExampleRequest

      An example HTTP request.
        Associations
        NameClassMultiplicityDescription
        exampleHeaderExampleHeader*
        An example header.
        Attributes
        NameClassArityDescription
        bodystring1
        The request's content, if any.
        methodverb1
        The request's HTTP verb (e.g. GET, POST, PUT, DELETE).
        urianyURI1
        The request's URI.

        ExampleResponse

        An example HTTP response.
          Associations
          NameClassMultiplicityDescription
          exampleHeaderExampleHeader*
          An example header.
          Attributes
          NameClassArityDescription
          bodystring1
          The response's content, if any. If the response's Content-Length is missing, the body is "" (the empty string).
          statusstatusCode1
          The HTTP status code.

          Parameter

          A request or response parameter.
            Associations
            NameClassMultiplicityDescription
            dataTypeDataType0..1
            The parameters datatype. Default: xsd:string.
            Attributes
            NameClassArityDescription
            defaultValuestring1
            The parameter's default value, if any.
            fixedboolean1
            Whether the parameter's value is constant. If true, the defaultValue must contain the value. Default: false.
            nameparamName1
            The parameter's name.
            requiredboolean1
            Whether the parameter is required. Default: false.

            Parameterized

            The abstract base class of all classes that may have parameters. A parameterized object contributes its associated parameters to an HTTP request. The association's name indicates where the parameter appears in the request.
            1. Subclass: Request
            2. Subclass: Resource
            Associations
            NameClassMultiplicityDescription
            headerParamParameter*
            A parameter that appears in a request header.
            pathParamParameter*
            A parameter that appears in the path of request's URI.
            queryParamParameter*
            A parameter that appears in a request's query string.

            Representation

            A resource's representation. The representation is carried in the body of an HTTP request or response. The following representation instances are pre-defined:
            wifl:Empty
            The empty representation contains the empty string "".
            wifl:JSON
            The JSON representation contains a schema-less JSON string. The contentType is application/json.
            wifl:XML
            The XML representation contains a schema-less XML document. The contentType is application/xml.
              Associations
              NameClassMultiplicityDescription
              representationTypeRepresentationType0..1
              The type of the representation. Default: rdfs:Resource.
              Attributes
              NameClassArityDescription
              contentTypemediaType1
              The representation's media type. The value appears in the Content-Type header of an HTTP request or response.

              Request

              A request to a resource.

              A request has exactly one HTTP method.

              A request can support zero or more alternative representations in its body. All of a request's representations are logically equivalent. A GET request typically has an empty body, and would not have any representation associations, while a POST request would have a representation association for each supported content type. A request has a response association for each possible response.

              A request's complete set of pathParams is that of its resource. A request's complete set of queryParams includes those it specifies directly and that of its resource. A request's complete set of headerParams includes those it specifies directly and that of its resource. If a request and its resource have different parameters with the same name, the request's parameter is used.

              Given a Request object, generate an HTTP request by following these steps:

              1. Set the HTTP method to the value of the Request's method attribute.
              2. Generate the URL.
                1. Create the Request's URI template by
                  1. Creating an RFC 6570 URI template expression whose operator is ? and whose variable-list has a varspec for each member of the Request's complete set of queryParams. The varspec is a varname whose value is that of the queryParam's name attribute.
                  2. Appending the URI template expression to the Request's Resource's complete URI path template.
                2. Create a binding for each name of the Request's complete set of pathParams and fixed or non-default queryParams from the Request's complete set of queryParams to the corresponding value in the run-time environment.
                3. Expand the Request's URI template according to RFC 6570 using the binding created in the previous step.
              3. Add the request headers.
                1. Create a binding for each name of the non-default headerParams from the Request's complete set of headerParams to the corresponding value in the run-time environment.
                2. For each member of the binding, add an HTTP header where the header name is the variable's name and the header value is the variable's value.

              If a Representation is to be submitted in the HTTP request, include the following steps:

              1. Set the HTTP request's Content-Type header to the value of the selected Representation's contentType attribute value.
              2. Add the entity body to the HTTP request.
              Superclass: Parameterized
                Associations
                NameClassMultiplicityDescription
                representationRepresentation*
                A representation that may be carried by this request.
                responseResponse*
                A response that may be returned.
                Attributes
                NameClassArityDescription
                methodverb1
                The request's HTTP verb (e.g. GET, POST, PUT, DELETE).

                Resource

                A collection of a resource's sub-resources, requests and their common parameters.

                A resource may support a number of different requests. A resource may specify parameters that are common to its requests.

                A resource may declare itself to be a sub-resource of another resource by using the parent association. A resource may declare its type to be that of another resource with the super association.

                A resource's complete URI path template is computed by appending its path value to the complete URI path template of its parent resource.

                A resource's complete sets of pathParams, queryParams, and headerParams include those it specifies directly and those it inherits. A resource inherits pathParams from its parent resource, if any. A resource inherits queryParams and headerParams from its super resources, if any. If a resource specifies a parameter with the same name as one it inherits, the resource's parameter is used.

                A resource's complete set of requests and responses includes those it specifies directly and the complete sets of its super resources.

                Superclass: Parameterized
                  Associations
                  NameClassMultiplicityDescription
                  parentResource0..1
                  A parent that provides a base URI path template and path parameters.
                  requestRequest*
                  A request supported by the resource.
                  responseResponse*
                  A response that may be returned for one or more requests.
                  superResource*
                  Super-resources that provide requests, responses, queryParams, and headerParams.
                  Attributes
                  NameClassArityDescription
                  pathuriTemplate0..1
                  A URI template for the resource's path. The path is specified by a URI template, which conforms to RFC 6570, excluding Path-style Parameter Expansion, Form-style Parameter Expansion, and Form-style Query Continuation. The path is ignored, and may be omitted, when the resource acts as a type for other resources.

                  Response

                  A response to a request. A response has a list of possible HTTP status codes. A response can support zero or more alternative representations in its body. All of a response's representations are logically equivalent.
                    Associations
                    NameClassMultiplicityDescription
                    headerParamParameter*
                    A parameter returned in the response header.
                    representationRepresentation*
                    A representation carried by the response.
                    Attributes
                    NameClassArityDescription
                    statusstatusCode1..*
                    A list of the response's possible HTTP status codes.

                    Datatype Classes

                    Attribute classes do not have associations or attributes. Many are defined by reference to an IETF RFC or a W3C Recommendation.

                    Datatype Classes
                    ClassSummary
                    anyURI
                    A Uniform Resource Identifier.
                    DataType
                    A reference to a data type.
                    fieldName
                    An HTTP header field name.
                    fieldValue
                    An HTTP header field value.
                    mediaType
                    A media content type.
                    paramName
                    An XML name token.
                    RepresentationType
                    A URI that refers to a type in a schema.
                    statusCode
                    An HTTP status code.
                    string
                    A character string.
                    Thing
                    An rdfs:Resource.
                    uriTemplate
                    A URI template.
                    verb
                    An HTTP method name.

                    anyURI

                    A Uniform Resource Identifier. The URI conforms to XML Schema Part 2: Datatypes (anyURI)

                      DataType

                      A reference to a data type. The reference must be resolvable to a URI that identifies the data type specification, given in XML Schema.

                        fieldName

                        An HTTP header field name. The name matches the field-name production of RFC 2616 Section 4.2.

                          fieldValue

                          An HTTP header field value. The value matches the field-value production of RFC 2616 Section 4.2.

                            mediaType

                            A media content type. A media type conforming to RFC 2616 Section 3.7.

                              paramName

                              An XML name token. The token conforms to XML Schema Part 2: Datatypes (NMTOKEN)

                                RepresentationType

                                A URI that refers to a type in a schema. The type definition within the schema specifies the syntax for the representation.

                                  statusCode

                                  An HTTP status code. A numeric HTTP status code as defined in RFC 2616 Section 6.1.1.

                                    string

                                    A character string. The character string conforms to XML Schema Part 2: Datatypes (string)

                                      Thing

                                      An rdfs:Resource.

                                        uriTemplate

                                        A URI template. The template conforms to RFC 6570

                                          verb

                                          An HTTP method name. Method names are found in RFC 2616 Section 5.1.1 (e.g. GET, POST, PUT, DELETE).