10-3 Rest Developers Guide
10-3 Rest Developers Guide
Version 10.3
October 2018
This document applies to webMethods Integration Server Version 10.3 and to all subsequent releases.
Specifications contained herein are subject to change and these changes will be reported in subsequent release notes or new editions.
Copyright © 2007-2018 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or
its affiliates and/or their licensors.
The name Software AG and all Software AG product names are either trademarks or registered trademarks of Software AG and/or
Software AG USA Inc. and/or its subsidiaries and/or its affiliates and/or their licensors. Other company and product names mentioned
herein may be trademarks of their respective owners.
Detailed information on trademarks and patents owned by Software AG and/or its subsidiaries is located at
hp://softwareag.com/licenses.
Use of this software is subject to adherence to Software AG's licensing conditions and terms. These terms are part of the product
documentation, located at hp://softwareag.com/licenses and/or in the root installation directory of the licensed product(s).
This software may include portions of third-party products. For third-party copyright notices, license terms, additional rights or
restrictions, please refer to "License Texts, Copyright Notices and Disclaimers of Third Party Products". For certain specific third-party
license restrictions, please refer to section E of the Legal Notices available under "License Terms and Conditions for Use of Software AG
Products / Copyright and Trademark Notices of Software AG Products". These documents are part of the product documentation, located
at hp://softwareag.com/licenses and/or in the root installation directory of the licensed product(s).
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with
Software AG.
Table of Contents
This guide is for developers using webMethods Integration Server to create REST
applications. This guide assumes basic knowledge of REST concepts and HTTP request
processing and familiarity with Software AG Designer and webMethods Integration
Server.
Document Conventions
Convention Description
Italic Identifies:
Variables for which you must supply values specific to your own
situation or environment.
New terms the first time they occur in the text.
References to other documentation sources.
Monospace Identifies:
font
Text you must type in.
Messages displayed by the system.
Program code.
{} Indicates a set of choices from which you must choose one. Type
only the information inside the curly braces. Do not type the { }
symbols.
Convention Description
... Indicates that you can type multiple options of the same type.
Type only the information. Do not type the ellipsis (...).
Software AG TECHcommunity
You can find documentation and other technical information on the Software AG
TECHcommunity website at “hp://techcommunity.softwareag.com”. You can:
Access product documentation, if you have TECHcommunity credentials. If you do
not, you will need to register and specify "Documentation" as an area of interest.
Access articles, code samples, demos, and tutorials.
Use the online discussion forums, moderated by Software AG professionals, to
ask questions, discuss best practices, and learn how other customers are using
Software AG technology.
Link to external websites that discuss open standards and web technology.
Data Protection
Software AG products provide functionality with respect to processing of personal data
according to the EU General Data Protection Regulation (GDPR). Where applicable,
appropriate steps are documented in the respective administration documentation.
Overview
Representational State Transfer (REST) is an architectural style used to build distributed
hypermedia systems. The World Wide Web is the best known example of such a system.
The focus of REST is on resources rather than services. A resource is a representation of
an object or information. A resource can represent:
A single entity, like a coffee pot you want to purchase from an online shopping site.
A collection of entities, like records from a database.
Dynamic information, like real-time status updates from a monitoring site.
That is, resources are the entities or collections of entities in a distributed system that
you want to post or retrieve or take action on. In a REST style system, each resource is
identified by a universal resource identifier (URI).
Development of REST systems is defined by a series of constraints:
Clients and servers are separate.
Communication between clients and servers is stateless.
Clients can cache responses returned from servers.
There may be intermediate layers between the client and server.
Servers can supply code for the clients to execute.
Clients and servers remain loosely coupled by communicating through a uniform
interface.
The uniform interface is the key constraint that differentiates REST from other
architectural approaches. The characteristics of this interface are:
Requests identify resources.
Responses contain representations of those resources.
Clients manipulate resources through their representations.
Messages are self-descriptive.
The interface employs Hypermedia as the engine of application state (HATEOAS),
which enables the client to find other resources referenced in the response.
One strength of REST is that it leverages the well understood methods supported by
HTTP to describe what actions should be taken on a resource. To be REST-compliant, an
application must support the HTTP GET, POST, PUT, PATCH, and DELETE methods.
Many applications use web browsers to interact with resources on the Internet. Web
browsers, however, typically support only the HTTP GET and HTTP POST methods.
To get around this restriction, you can use Integration Server to build REST-compliant
applications that support all five methods.
Integration Server can be a REST server or a REST client. When Integration Server acts
as a REST server, it hosts an application that you write. The application includes services
that you write that instruct Integration Server to process some or all of the HTTP GET,
POST, PUT, PATCH, and DELETE methods in request messages against resources.
When Integration Server acts as a REST client, it sends specially formaed requests to
the REST server.
Where... Is the...
More complex request messages can contain more explicit information about the
resource.
Status Line
The status line consists of the HTTP version followed by a numeric status code and
a reason phrase. The reason phrase is a brief textual description of the status code.
Integration Server will always set the HTTP version to match the version of the client
that issued the request. You cannot change the HTTP version.
You can use the pub.flow:setResponseCode service to set the status code and reason phrase.
You can also set the status code and reason phrase of an HTTP request by adding a
variable named $hpResponse that references the pub.flow:httpResponse document type
to the flow service pipeline. For more information on this document type, see the
section pub.flow:HTTPResponse in the webMethods Integration Server Built-In Services
Reference. If you do not explicitly set the status code, Integration Server will set it to 200
for successfully completed requests and an appropriate error code for unsuccessful
requests.
HTTP/1.1 defines all the legal status codes in Section “hp://www.w3.org/Protocols/
rfc2616/rfc2616-sec10.html#sec10”. Examine these codes to determine which are
appropriate for your application.
Header Fields
You can communicate information about the request and the response through
header fields in the HTTP response. Integration Server will generate some header
fields, such as Set-Cookie, WWW-Authenticate, Content-Type, Content-Length, and
Connection. You can use the pub.flow:setResponseHeader to set Content-Type and other
header fields. You can also set the header fields of an HTTP request by adding a variable
named $hpResponse that references the pub.flow:httpResponse document type to the
flow service pipeline. For more information on this document type, see the section
pub.flow:HTTPResponse in the webMethods Integration Server Built-In Services Reference..
HTTP/1.1 defines the header fields that can appear in a response in three sections of RFC
2616: “4.5”, “6.2”, and “7.1”. Examine these codes to determine which are appropriate
for your application.
Message Body
The message body usually contains a representation of the requested resource, one or
more URLs that satisfy the request, or both. In some cases, the message body should be
empty, as specified in “RFC 2616, Section 4.3”
You can use the pub.flow:setResponse service to explicitly set the message body. You can
also set the message body of an HTTP request by adding a variable named $hpResponse
that references the pub.flow:httpResponse document type to the flow service pipeline. For
more information on this document type, see the section pub.flow:HTTPResponse in the
webMethods Integration Server Built-In Services Reference.. If you do not explicitly set the
message body, the output pipeline of the top-level service will be returned to the client
in the message body.
In URL template-based approach, Integration Server returns the output defined in the
output of the service as a response to the client.
For more information about how Integration Server builds HTTP responses, see the
section About Content Handlers for HTTP Responses in the webMethods Integration Server
Administrator’s Guide.
You can use the legacy approach to create a new REST resource that include the
REST resource folder and the flow services that correspond to HTTP methods. REST
resources generated using the legacy approach are invoked with the rest directive. For
information about the procedure to configure REST resources, see the webMethods Service
Development Help.
On Integration Server the resources of your application are represented as folders within
a package. For each resource, you will write individual services for the HTTP methods
that you want Integration Server to execute against the resource. Those services must
be named _get, _post, _put, _patch, and _delete, and they are stored in the folder for the
resource. For more information, see “Seing Up a REST Application Using the Legacy
REST Approach” on page 40.
Consider a Discussion application that maintains a database of discussions about
different topics. The following examples show how Integration Server would parse these
REST requests.
Example 1
Here is a request to obtain a list of all topics contained in the database, and how
Integration Server parses the request:
GET /rest/discussion/topic HTTP/1.1
Where... Is the...
Example 2
Here is a request to display information about topic number 3419, and how Integration
Server parses the request:
GET /rest/discussion/topic/3419 HTTP/1.1
Where... Is...
Example 3
Here is a request to display information about a particular comment, 17 for example,
and how Integration Server parses the request:
GET /rest/discussion/topic/3419/comment/17 HTTP/1.1
Where... Is...
Example 4
Here is a request to display information contributed by participant Robertson in 2009
about topic 17, and how Integration Server parses the request:
GET /rest/discussion/topic/3419/comment/17?year=2009&name=Robertson
HTTP/1.1
Where... Are...
year and name Input variables that are specific to your application. Tokens
specified after the ? must be entered as name/value pairs. In
this example, year=2009 and name=Robertson narrow the
focus of the GET request to entries that participant Robertson
added to comment 17 in 2009.
Note: You can configure URL aliases only for REST resources configured using the
legacy approach.
When partial matching is enabled and Integration Server receives a REST request URL,
an alias is considered a match if the entire alias matches all or part of the request URL,
starting with the first character of the request URL's path.
For example, assume the following URL aliases are defined:
a1 rest/purchasing/order
a2 rest/purchasing/invoice
a22 rest/purchasing/admin
a3 invoke/pub.flow/debugLog
When partial matching is enabled, the following request URLs would get different
results:
A request URL of hp://MyHost:5555/a1 matches URL alias a1 exactly. The resulting
URL is hp://MyHost:5555/rest/purchasing/order.
A request URL of hp://MyHost:5555/a2/75909 matches alias a2 because the request
URL's path begins with "a2". The trailing characters of the request URL are retained
and the resulting URL is hp://MyHost:5555/rest/purchasing/invoice/75909.
A request URL of hp://MyHost:5555/a1/75909/customer/0122?terms=net7 matches
alias a1 because the request URL's path begins with "a1". The trailing characters
of the request URL are retained and the resulting URL is hp://MyHost:5555/rest/
purchasing/order/75909/customer/0122?terms=net7.
In some cases, a partial match can result in an invalid request. For example, a request
URL of hp://host:5555/a3456 matches alias a3 because the request URL's path
begins with "a3". The trailing characters of the request URL are retained and the
You can use the URL template-based approach to configure REST resources. In this
approach, you define a URL template for client requests to use and invoke the resources.
REST resources configured using this approach are also known as REST V2 resources.
For each REST V2 resource, you must define operations that include the following:
The format of the URL that REST clients must follow when sending requests to
Integration Server acting as the REST server. Integration Server aempts to match a
request URL received from any application against the URL template defined for a
REST V2 resource operation and determines whether the request URL is valid.
The HTTP methods supported by the resource operation.
The flow service associated with a resource operation. You can either associate an
existing service with a resource operation or create a new service and associate it
with the resource operation.
The URL template-based approach provides you with greater flexibility than the legacy
approach in defining REST resources. For a REST V2 resource, you can define multiple
operations and associate each operation with a URL template, HTTP methods, and a
flow service. In addition, you can edit these details based on your requirements.
Important: You cannot configure REST V2 resources when Integration Server is deployed
in a multitenanted environment.
Note: For information about creating REST V2 resources and defining resource
operations, see webMethods Service Development Help.
While a URL template definition can include multiple dynamic parameters, each
dynamic parameter can appear only once in the URL template.
A URL template cannot include the following characters: & ; ? @ # | [ ]
Query parameters are not supported in the definition of a URL template. However,
the request URL from the client application to Integration Server can include query
parameters at run time.
Ensure that the resource operations in a REST V2 resource are unique, which is a
combination of URL template and the HTTP method.
You can define a logical representation of a resource that is associated with the REST
V2 resource.
You can define aributes for the REST V2 resource.
You can define relationships between REST V2 resources so that using a single
resource all related resources can be accessed.
Important: To invoke REST APIs, Software AG recommends that you create REST API
descriptors.
Where... Is the...
Where... Is the...
configuring supported HTTP methods for services, see
webMethods Service Development Help.
Example 2
Consider a REST V2 resource operation configured with the following URL template:
/restv2/app:discussionNode/discussion/topic/t-{id}
Here is a request to display information about a topic based on its identifier and how
Integration Server parses the request:
GET /restv2/app:discussionNode/discussion/topic/t-1591 HTTP/1.1
Where... Is the...
t-1591 Identifier for a topic. In the URL template specified for this
example, t is a static parameter while {id} is a dynamic
parameter. Integration Server matches the value t-1591
against the topic identifier parameters specified in the URL
template (t-{id}).
Where... Is the...
the REST V2 resource operation. However, an identifier
that does not follow the specified format, for example,
236 would be considered invalid.
Example 3
Consider a REST V2 resource operation configured with the following URL template:
/restv2/app:discussionNode/discussion/topic/t-{id}/comment/{cid}
Where... Is the...
ResourceName_: Contains the relevant documents under docTypes folder and services
under services folder for the JSON API based REST V2 resource.
docTypes: Contains all the automatically generated document types corresponding to
the resource.
services: Contains automatically generated services for the resource. Each service
corresponds to the automatically created URL templates.
This following example creates two REST V2 resources as Article and Author and
both the resources are JSON API compliant. You can create the aributes for Article
ensuring that one aribute, for example, id is set as unique identifier. Integration Server
generates the REST URL templates based on this unique identifier. For more information
about creating a JSON API compliant REST V2 resource and adding new aributes, see
webMethods Service Development Help.
Integration Server generates the following URL templates according to the JSON
API specifications. You can check these URLs and modify them under the Resource
Configuration tab. For example,
/Article GET
/Article/{id} GET
/Article POST
/Article/{id} DELETE
/Article/{id} PATCH
You can assign a relationship between Article and Author by seing the aribute type
as Resource. Integration Server generates the following relationship URL templates
according to the JSON API specification:
/Article/{id}/Author GET
/Article/{id}/Author PATCH
/Article/{id}/Author DELETE
Once you create the assets, the package viewer might have the following folder structure
as viewed from Software AG Designer.
Response format:
{
"data": [
{
"id": "1",
"type": "Article",
"attributes": {
"blogname": "facebook"
},
"relationships": {
"Author": {
"data": {
"id": "2",
"type": "Author"
},
"links": {
"self": "http://host
:port/rad/nameSapce/Article/1/
relationships/Author",
"related": "http://host:port/
rad/nameSapce/Article/1/Author"
}
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1"
}
},
{
"id": "3",
"type": "Article",
"attributes": {
"blogname": "gmail"
},
"relationships": {
"Author": {
"data": {
"id": "4",
"type": "Author"
},
"links": {
"self": "http://host:port/rad/nameSapce/
Article/3/relationships/Author",
"related": "http://host:port/rad/nameSapce/
Article/3/Author"
}
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/3"
}
}
],
"links": {
"self": "http://host:port/rad/nameSapce/Article"
},
"meta": {
"total-records": "2"
}
}
Response format:
{
"data": {
"id": "1",
"type": "Article",
"attributes": {
"blogname": "facebook"
},
"relationships": {
"Author": {
"data": {
"id": "2",
"type": "Author"
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1/
relationships/Author",
"related": "http://host:port/rad/nameSapce/Article/1/
Author"
}
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1"
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1"
},
"meta": {
"total-records": "1"
}
}
Response format: Response status is 204. If UID is set or any response code is set
then the response is,
{
"data": {
"id": "1",
"type": "Article",
"attributes": {
"blogname": "facebook"
},
"relationships": {
"Author": {
"data": {
"id": "2",
"type": "Author"
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1/
relationships/Author",
"related": "http://host:port/rad/nameSapce/Article/1/
Author"
}
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1"
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article"
},
"meta": {
"total-records": "1"
}
}
Patch a record
Response format:
{
"data": {
"id": "1",
"type": "Article",
"attributes": {
"blogname": "facebook"
},
"relationships": {
"Author": {
"data": {
"id": "2",
"type": "Author"
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1/
relationships/Author",
"related": "http://host:port/rad/nameSapce/Article/1/
Author"
}
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1"
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1"
},
"meta": {
"total-records": "1"
}
}
Response format:
{
"data": [
{
"id": "2",
"type": "Author",
"attributes": {
"name": "social"
},
"relationships": {},
"links": {
"self": "http://host:port/rad/nameSapce/Author/2"
}
}
],
"links": {
"self": "http://host:port/rad/nameSapce/Article/1/Author"
},
"meta": {
"total-records": "1"
}
}
Response format:
{
"data": {
"id": "2",
"type": "Author",
"attributes": {
"name": "social"
},
"relationships": {},
"links": {
"self": "http://host:port/rad/nameSapce/Author/2"
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1/Author"
},
"meta": {
"total-records": "1"
}
}
"relationships": {
"Author": {
"data": {
"id": "4",
"type": "Author"
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/3/
relationships/Author",
"related": "http://host:port/rad/nameSapce/Article/3/
Author"
}
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/3"
}
}
],
"included": [
{
"id": "2",
"type": "Author",
"attributes": {
"name": "social"
},
"relationships": {},
"links": {
"self": "http://host:port/rad/nameSapce/Author/2"
}
},
{
"id": "4",
"type": "Author",
"attributes": {
"name": "mail"
},
"relationships": {},
"links": {
"self": "http://host:port/rad/nameSapce/Author/4"
}
}
],
"links": {
"self": "http://host:port/rad/nameSapce/Article"
},
"meta": {
"total-records": "2"
}
}
Response format:
{
"data": {
"id": "1",
"type": "Article",
"attributes": {
"blogname": "facebook",
"id": "1"
},
"relationships": {
"Author": {
"data": {
"id": "2",
"type": "Author"
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1/
relationships/Author",
"related": "http://host:port/rad/nameSapce/Article/1/
Author"
}
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1"
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1"
},
"meta": {
"total-records": "1"
}
}
Sort a record
Request format: http://host:port/rad/nameSapce/Article?
fields=id,blogname&sort=-id
Response format:
{
"data": [
{
"id": "3",
"type": "Article",
"attributes": {
"blogname": "gmail",
"id": "3"
},
"relationships": {
"Author": {
"data": {
"id": "4",
"type": "Author"
}
}
}
},
{
"id": "1",
"type": "Article",
"attributes": {
"blogname": "facebook",
"id": "1"
},
"relationships": {
"Author": {
"data": {
"id": "2",
"type": "Author"
}
}
}
}
],
"links": {
"self": "http://host:port/rad/nameSapce/Article"
},
"meta": {
"total-records": "2"
}
}
Filter a record
Request format: http://host:port/rad/nameSapce/Article?filter[id]
[EQ]='xyz'
Response format: In pipeline $filter value is set so user needs to implement the
service according to the filter.
Page number and page limit of a record
Request format: http://host:port/rad/nameSapce/Article?
page[number]=0&page[limit]=1
Response format:
{
"data": [
{
"id": "1",
"type": "Article",
"attributes": {
"blogname": "facebook"
},
"relationships": {
"Author": {
"data": {
"id": "2",
"type": "Author"
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1/
relationships/Author",
"related": "http://host:port/rad/nameSapce/Article/1/
Author"
}
}
},
"links": {
"self": "http://host:port/rad/nameSapce/Article/1"
}
}
],
"links": {
"self": "http://host:port/rad/nameSapce/Article",
"last": "http://host:port/rad/nameSapce/
Article?page[offset]=1&page[limit]=1"
},
"meta": {
"total-records": "2"
}
}
Service Description
These services reside in folders on your Integration Server in a directory structure that
is specific to your application. For example, the discussion application described in
“Configuring a REST Resource Using the Legacy Approach” on page 15 might have the
following structure as viewed from Software AG Designer:
In addition to the _get, _put, _post, _patch, and _delete services, you can also place a special
service named _default in one or more of the application folders. Integration Server
executes this service if a REST request specifies an HTTP method that is not represented
by a service in the folder. For example, suppose the folder contains the _get, _put, and
_post services, but no _patch or _delete service. If the client issues a DELETE request,
Integration Server will execute the _default service, and pass “DELETE” to it in the
$hpMethod variable.
If a request specifies an HTTP request method that is not represented by a service in the
folder and there is no _default service in the folder, the request fails with the “404 Not
Found” or “405 Method Not Allowed error.” Integration Server issues 404 if the first
token in the URI does not exist in the namespace, or 405 if one or more tokens in the
URI identify elements in the namespace but the URI does not correctly identify a REST
resource folder and a service to execute.
Example 1
A REST resource’s folder contains the _get, _post, and _default services:
Example 2
A REST resource’s folder contains the _get, _put, and _delete services:
Configuration
There are a few things you can configure with respect to REST processing:
Name of the REST directive
Note: You can configure the name of the REST directive only for resources that
use the rest directive, that is, the REST resources configured using the
legacy approach.
If you want to allow clients to specify a name other than “rest” for the REST
directive, you can do so with the wa.server.RESTDirective configuration parameter.
For example, to allow clients to specify “process” for the REST directive, you would
change the property to the following:
watt.server.RESTDirective=process
With this seing, clients can specify “rest” or “process” for the REST directive. In the
following example, the two requests are equivalent:
METHOD /process/discussion/topic/9876 HTTP/1.1
Note: If you use the invoke directive, you cannot use the $resourceID and $path
pipeline variables. In addition, you cannot use the _default service.
Note: You can create REST API descriptors using the legacy approach to expose the
legacy REST APIs as Swagger document.
Using Designer you can create a REST API descriptor using resource first or Swagger
first approach.
Resource first refers to REST API descriptors created using the REST v2 resource.
For more information about creating a REST API descriptor using the resource first
approach, refer to the webMethods Service Development Help.
Note: The base path of the created REST API descriptor is set as /rad/
<namespaceName of the REST API descriptor> or path in the Swagger
document. You can change the base path. To avoid exposing the server
namespace name to the end user, set the base path to an application
specific path. Also, when you change the base path, you must create a URL
alias with the defined base path. For more information about creating a
URL alias, refer to the webMethods Service Development Help.
Note: In the Swagger first approach to create a REST API descriptor, Integration
Server automatically creates a URL alias for the base path of the created
REST API descriptor.
You can use REST API descriptors to access a Swagger document through a URL in
JSON and YAML format.
The standard URLs to access the Swagger document are:
JSON Format: hp://host:port/<base_path>?swagger.json
YAML Format: hp://host:port/<base_Path>?swagger.yaml
The following table lists the standard URLs under appropriate conditions:
If the URL includes.. URL in JSON format is.. URL in YAML format is..
The server response type for a JSON based application is, application/json and for a
YAML based application is, application/x-yaml .
You can also access the Swagger document for REST API descriptor that is created using
the legacy REST resources using the above mentioned URLs.
Note: If the REST API Descriptor does not exist in the Integration Server namespace
or if the format is not swagger.json or swagger.yaml , Integration Server returns
an error message. For example, if the URL is hp://host:port/api?swagger.xml ,
then the Integration Server throws an error.
If a REST request specifies an HTTP method that is not allowed for its service, the
request fails with a “405 Method Not Allowed error.
Example 1
A REST service and its corresponding resource support the GET, PUT, and DELETE
services:
Note: This example assumes that the request URL is in a format supported by the
REST resource.
Configuration
There are a few things you can configure with respect to REST V2 processing:
Name of the REST V2 directive
If you want to allow clients to specify a name other than “restv2” for the REST
V2 directive, you can do so with the wa.server.RESTDirective.V2 configuration
parameter. For example, to allow clients to specify “process” for the REST V2
directive, you would change the property to the following:
watt.server.RESTDirective.V2=process
With this seing, clients can specify “restv2” or “process” for the REST directive. In
the following example, the two requests are equivalent:
METHOD /process/discussion/topic/9876 HTTP/1.1