Overview
WADL Specification:https://api.petstoreapi.com/v1/specs/modern-petstore.wadl
Protocol: XML-based description language for HTTP APIs
WADL Version: Following the W3C WADL 2009-02 specification
WADL is a machine-readable XML format that describes HTTP-based web applications and RESTful web services. It provides a structured way to describe resources, methods, parameters, and representations.
What is WADL?
WADL (Web Application Description Language) is an XML-based file format that provides a machine-readable description of HTTP-based web applications. It was designed to simplify the development and documentation of RESTful web services.Key Features
- ✅ Resource-Oriented: Describes REST resources and their hierarchies
- ✅ Method Definitions: Specifies HTTP methods (GET, POST, PUT, DELETE, etc.)
- ✅ Parameter Description: Documents path, query, and header parameters
- ✅ Media Types: Defines request and response representations
- ✅ Type System: Uses XML Schema types for validation
- ✅ Tool Generation: Enables automatic client generation
When to Use WADL
WADL is particularly useful when:- Working with Java-based web services
- Using tools that consume WADL (like JAX-RS)
- Integrating with legacy systems expecting WADL
- Generating client code from service descriptions
- Documenting RESTful APIs in XML format
WADL Structure
Our WADL specification follows this structure:Downloading the WADL Specification
Direct Download
Specification Details
The WADL specification includes:- 11 resource paths: All REST API endpoints
- 18 HTTP methods: Complete CRUD operations
- Path parameters: Template-style parameters with validation
- Query parameters: Filtering and pagination support
- Request bodies: JSON representations with schema references
- Response definitions: Status codes and media types
- Documentation: Inline descriptions for all elements
Understanding WADL Elements
Application Element
The root element containing the entire API description:Resources Element
Defines the base URL and contains all resource definitions:Resource Element
Represents a REST resource with its path and operations:Method Element
Describes an HTTP operation on a resource:Parameter Element
Defines input parameters:template: Path parameters (e.g.,/pets/{id})query: Query string parameters (e.g.,?species=DOG)header: HTTP headers (e.g.,Authorization)
Representation Element
Describes request/response bodies:Using WADL
Generate Client Code
WADL enables automatic client generation for various languages:Java (JAX-RS)
Python (wadllib)
Validate API Calls
Use WADL to validate requests before sending:API Examples
List Pets
WADL Definition:Get Pet
WADL Definition:Create Pet
WADL Definition:Type System
WADL uses XML Schema Data Types (XSD) for parameter and representation types:Basic Types
| WADL Type | Description | Example |
|---|---|---|
xsd:string | Text string | ”Buddy” |
xsd:int | 32-bit integer | 24 |
xsd:long | 64-bit integer | 9007199254740991 |
xsd:float | Single-precision float | 123.45 |
xsd:double | Double-precision float | 123.456789 |
xsd:boolean | Boolean value | true, false |
Array Parameters
Use therepeating="true" attribute for array-type parameters:
Best Practices
1. Path Parameters at Resource Level
Define path parameters once at the resource level, not repeated in each method:2. Use Meaningful IDs
Give each method a unique, descriptive ID:3. Document Everything
Include documentation for all elements:4. Specify Default Values
Include default values for optional parameters:WADL vs OpenAPI
| Feature | WADL | OpenAPI |
|---|---|---|
| Format | XML | YAML/JSON |
| Readability | Machine-focused | Human-friendly |
| Schema Language | XML Schema (XSD) | JSON Schema |
| Tooling | Java-centric (JAX-RS) | Multi-language |
| Adoption | Legacy systems | Modern APIs |
| Documentation | XML comments | Rich markdown |
| Webhooks | Not supported | Supported (3.x+) |
| Use Case | Java web services | Cross-platform APIs |
When to Choose WADL
Use WADL if:- ✅ Working with Java/JAX-RS frameworks
- ✅ Integrating with legacy enterprise systems
- ✅ Client tools require WADL format
- ✅ Using XML-based toolchains
When to Choose OpenAPI
Use OpenAPI if:- ✅ Building modern REST APIs
- ✅ Need human-readable documentation
- ✅ Want rich tooling ecosystem
- ✅ Require webhook/callback support
- ✅ Targeting multiple languages
Tools and Libraries
Java
JAX-RS (Jersey)Python
wadllibValidation
xmllint (libxml2)Migration Guide
From WADL to OpenAPI
If you’re migrating from WADL to OpenAPI:- Resource Mapping: WADL
<resource>→ OpenAPIpaths - Method Mapping: WADL
<method>→ OpenAPI operation objects - Parameters: WADL
<param>→ OpenAPIparameters - Types: XSD types → JSON Schema types
- Documentation: WADL
<doc>→ OpenAPIdescription
From OpenAPI to WADL
Our conversion script (scripts/oas32-to-wadl.mjs) automatically converts OpenAPI to WADL:
Additional Resources
- WADL Specification: https://api.petstoreapi.com/v1/specs/modern-petstore.wadl
- W3C WADL Spec: http://www.w3.org/Submission/wadl/
- JAX-RS Documentation: https://eclipse-ee4j.github.io/jersey/
- Related Protocols:
Support
For questions or issues with the WADL specification:- GitHub Issues: https://github.com/petstoreapi/PetstoreAPI/issues
- Documentation: https://docs.petstoreapi.com
- API Reference: https://docs.petstoreapi.com