REST/SOAP endpoints

Learn how to create REST and SOAP endpoints.

An endpoint can be created as wither REST or SOAP to access web services. Messaging in SOAP is based on the use of XML while REST uses URLs to send and receive messages. The type of REST message (request) is determined by the use of HTTP 1.1 verbs (GET, POST, PUT, PATCH and DELETE). Normally, the response is returned as Javascript Object Notation (JSON).

A project requires at least one endpoint. However, you can create as many endpoints in a project as required within a project.

Any created endpoint is reachable with or without a trailing slash. For example, if your published endpoint is .../foo, then it is also reachable by .../foo/.

REST HTTP methods

The following table describes the REST HTTP methods supported by Xapix.

Method

Description

GET

Request to retrieve data (resource).

POST

Request to create a new resource using data provided in the body of the request.

PUT

Request to update (or completely replace) an existing resource using the data you want to change.

PATCH

Request to modify an existing resource using the data you want to change.

DELETE

Request to delete the resource.

Endpoint path

The following shows the structure of an endpoint path in Xapix.

<organization-name>/<project-name>/<resource>/<subresource>/{parameter}

Here is an example from the Xapix quickstart.

/xapix-io-api-data/vehicle-demo/engines/{engine_id}.json

Path element

Description

<organization-name>

Organization in which you created the project that contains the endpoint.

<project-name>

Project containing the endpoint.

<resource>

Top level exposed resource.

<subresource>

Subsequent level exposed resource.

{parameter}

Path parameter within curly braces { }.

Path parameters are variable parts of a URL path. They are used to point to a specific resource. A URL can have several path parameters, each denoted with curly braces { }. The order of the path parameters are important. See Here for more details. ‚Äč

Endpoint extensions

Using an extension ensures the response to a request made to the API is in the format indicated by the extension. This can be used in place of Accept headers which may be required when making a response from a browser, for instance. A browser may only accept JSON or XML; therefore, using an endpoint extension makes the format of the response explicit to the browser.

In the example shown below (also shown above), the extension is shown as .json. This causes a response from the API to be in JSON.

/xapix-io-api-data/vehicle-demo/engines/{engine_id}.json

The response provided by the API to this endpoint is formatted in JSON.

"manufacturer":"Remedy Engines",
"power_hp":"180",
"price":"4800.0"
}

Likewise, if an endpoint had an .xml extension, the response would be formatted in XML.