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.
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.
Class | Summary |
---|---|
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.
|
Name | Class | Multiplicity | Description |
---|---|---|---|
exampleRequest | ExampleRequest | * |
An example request.
|
exampleResponse | ExampleResponse | * |
An example response.
|
seeAlso | Thing | * |
The URI of a related resource.
|
Name | Class | Arity | Description |
---|---|---|---|
name | fieldName | 1 |
The header's name.
|
value | fieldValue | 1 |
The header's value.
|
Name | Class | Multiplicity | Description |
---|---|---|---|
exampleHeader | ExampleHeader | * |
An example header.
|
Name | Class | Multiplicity | Description |
---|---|---|---|
exampleHeader | ExampleHeader | * |
An example header.
|
Name | Class | Arity | Description |
---|---|---|---|
body | string | 1 |
The response's content, if any.
If the response's Content-Length is missing,
the body is "" (the empty string).
|
status | statusCode | 1 |
The HTTP status code.
|
Name | Class | Multiplicity | Description |
---|---|---|---|
dataType | DataType | 0..1 |
The parameters datatype. Default: xsd:string.
|
Name | Class | Arity | Description |
---|---|---|---|
defaultValue | string | 1 |
The parameter's default value, if any.
|
fixed | boolean | 1 |
Whether the parameter's value is constant. If true,
the defaultValue must contain the value. Default: false.
|
name | paramName | 1 |
The parameter's name.
|
required | boolean | 1 |
Whether the parameter is required. Default: false.
|
Name | Class | Multiplicity | Description |
---|---|---|---|
representationType | RepresentationType | 0..1 |
The type of the representation. Default: rdfs:Resource.
|
Name | Class | Arity | Description |
---|---|---|---|
contentType | mediaType | 1 |
The representation's media type.
The value appears in the Content-Type header
of an HTTP request or response.
|
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:
?
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.If a Representation is to be submitted in the HTTP request, include the following steps:
Name | Class | Multiplicity | Description |
---|---|---|---|
representation | Representation | * |
A representation that may be carried by this request.
|
response | Response | * |
A response that may be returned.
|
Name | Class | Arity | Description |
---|---|---|---|
method | verb | 1 |
The request's HTTP verb (e.g. GET, POST, PUT, DELETE).
|
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.
Name | Class | Multiplicity | Description |
---|---|---|---|
parent | Resource | 0..1 |
A parent that provides a base URI path template and path parameters.
|
request | Request | * |
A request supported by the resource.
|
response | Response | * |
A response that may be returned for one or more requests.
|
super | Resource | * |
Super-resources that provide requests, responses, queryParams, and headerParams.
|
Name | Class | Arity | Description |
---|---|---|---|
path | uriTemplate | 0..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.
|
Name | Class | Multiplicity | Description |
---|---|---|---|
headerParam | Parameter | * |
A parameter returned in the response header.
|
representation | Representation | * |
A representation carried by the response.
|
Name | Class | Arity | Description |
---|---|---|---|
status | statusCode | 1..* |
A list of the response's possible HTTP status codes.
|
Attribute classes do not have associations or attributes. Many are defined by reference to an IETF RFC or a W3C Recommendation.
Class | Summary |
---|---|
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.
|
field-name
production of
RFC 2616 Section 4.2.field-value
production of
RFC 2616 Section 4.2.