This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
HTTP Endpoint
The HTTP endpoint allows you to define REST endpoints using URI templates similar to the REST API. The URI templates allow a RESTful URI to contain variables that can be populated during mediation runtime using property values whose names have the "uri.var.
" prefix. An HTTP endpoint can also define the particular HTTP method to use in the RESTful invocation.
XML Configuration
If you want to configure the HTTP Endpoint using XML, click the Switch to source view link on the HTTP Endpoint page, and then use the following syntax:
<http uri-template="URI Template" method="GET|POST|PATCH|PUT|DELETE" />
HTTP Endpoint Attributes
Attribute | Description |
---|---|
uri-template | The URI template that constructs the RESTful endpoint URL at runtime. |
method | The HTTP method to use during the invocation. |
Example
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint"> <http uri-template="http://localhost:8080/{uri.var.servicepath}/restapi/{uri.var.servicename}/menu?category={uri.var.category}&type={uri.var.pizzaType}" method="GET"> </http> </endpoint>
The URI template variables in this example HTTP endpoint can be populated during mediation as follows:
<inSequence> <property name="uri.var.servicepath" value="PizzaShopServlet"/> <property name="uri.var.servicename" value="PizzaWS"/> <property name="uri.var.category" value="pizza"/> <property name="uri.var.pizzaType" value="pan"/> <send> <endpoint key="HTTPEndpoint"/> </send> </inSequence>
This configuration will cause the RESTful URL to evaluate to:
http://localhost:8080/PizzaShopServlet/restapi/PizzaWS/menu?category=pizza&type=pan
UI Configuration
- On the Add Endpoint tab, click HTTP Endpoint (see Adding an Endpoint). The HTTP Endpoint page appears with its default view.
- Specify a unique name for this endpoint, and then enter the URI template, inserting "
uri.var.
" before each variable. To test the URI, click Test. - Specify the HTTP method to use during the invocation of this endpoint.
- Optionally, add advanced options and properties as described in Adding an Endpoint.Â