On This Page
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://apitest.cybersource.com/pts/v2/payments/
The main part of the resource path begins after the host, apitest.cybersource.com.
/pts/v2/payments
is the address (resource) on the Cybersource end that
processes transaction detail requests. Cybersource returns a request ID 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 Cybersource JSON request messages using the API Reference docs in the Cybersource Developer
Center.
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 tells Cybersource that the message is
legitimate.