REST API

REST Components

A REST message contains these components:
  • Resource Path
  • HTTP Verb
  • Body
  • Header

Resource Path (request target)

The path to the resource (object) to be acted upon. The ID of the resource must be provided in the path.
For example, the following resource path identifies a specific transaction (resource) in our database:
https://api.smartpayfuse-test.barclaycard
/pts/v2/payments/
The main part of the resource path begins after the host,
api.smartpayfuse-test.barclaycard
.
/pts/v2/payments
is the address (resource) on the endpoint that processes transaction detail requests. A request ID is returned that provides transaction details you can use for follow-up transactions, queries, or reference.

HTTP Verb

The verb defines the action to take regarding the resource:
Available verbs:
  • POST—Creates a resource
  • GET—Retrieves one or more resources
  • PUT—Updates a resource
  • DELETE—Deletes a resource
These verbs are referred to as
CRUD
operations. They allow the
C
reation,
R
etrieval,
U
pdate and
D
eletion of resources.

Body

A POST or PUT request has a body. A GET request has no body. REST uses JSON (JavaScript Object Notation) as its content format. To help with the structure of your requests, you can generate sample JSON request messages using the
API Reference
in the developer
portal
: API Reference .

Header

The header is a collection of fields and their associated values that provides information about the message to the receiver. Think of it as metadata about the message. The header also contains authentication information that indicates that the message is legitimate.