A REST message contains these components:
- Resource Path
- HTTP Verb
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:
The main part of the resource path begins after the host, apitest.cybersource.com.
/pts/v2/paymentsis 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.
The verb defines the action to take regarding the resource:
- POST—Creates a resource
- GET—Retrieves one or more resources
- PUT—Updates a resource
- DELETE—Deletes a resource
These verbs are referred to as
CRUDoperations. They allow the
Deletion of resources.
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.