REST API

Send the Request

This topic provides information about coding your request using an HTTP endpoint comprising an HTTP Verb and Resource Path (request target).

Generate the Endpoint

The endpoint is essentially the Resource Path (request target) formatted as a fully qualified URL. The following example shows a properly formatted endpoint.
https://apitest.cybersource.com
/pts/v2/payments/
Endpoint for a POST Request
The proper path for a payment request contains an HTTP prefix, followed by the host and request target. Using the above endpoint as an example, we can break it down into its components.
Prefix
Host
Request target (suffix)
https://
apitest.cybersource.com
/pts/v2/payments/
Endpoint for a GET Request
The proper path for a Transaction Detail contains the same prefix, host, and request target as that of a payment request. The ID that prompts the return to include a detail record for that specific transaction is added at the end of the endpoint.
https://apitest.cybersource.com
/tss/v2/transactions/5434091601766673504001
Prefix
Host
Request target (suffix)
ID
https://
apitest.cybersource.com
/pts/v2/payments/
5434091601766673504001
How to Handle Query Parameters
GET requests that contain no message body send name-value pairs to the server using query parameters. The following example shows the request target for a Secure File Share file list query.
get /sfs/v1/file-details?organizationId=mymid&startDate=2018-12-10&endDate=2018-12-11
The following example shows how to format this query as an endpoint with query parameters in the URL.
https://apitest.cybersource.com
/sfs/v1/ file-details?organizationId=mymid&startDate=2018-12-10&endDate=2018-12-11
Prefix
https://
Host
apitest.cybersource.com
Request Target
/sfs/v1/file-details
Query Parameters (Querystring)
?organizationId=mymid&startDate=2018-12-10&endDate=2018-12-11
The last part of the URL is the list of parameters, also called the
querystring
. The querystring is a list of name-value pairs in the format of
?name1=value&name2=value&nameN=value
. The
?
designates the start of a querystring. The querystring is appended to the resource. Do not use a slash between the resource and the querystring.
The following example shows signature parameters for a querystring. During the signature parameter generation, the request target must contain the full querystring.
host:
apitest.cybersource.com
date: Sat, 15 Dec 2018 01:47:45 GMT (request-target): get /sfs/v1/file-details?organizationId= mymid&startDate=2018-12-10&endDate=2018-12-11 v-c-merchant-id: mymid
The following example shows a sample request target for the Secure File Share file download resource. It combines an ID and a querystring.
get /sfs/v1/files/UGF5bWVudEJhdGNoRGV0YWlsUmVwb3J0LnhtbC0yMDE4LTEyLTEw?organizationId=mymid
The following example shows the above example formatted as an endpoint.
https://apitest.cybersource.com
/sfs/v1/files/ UGF5bWVudEJhdGNoRGV0YWlsUmVwb3J0LnhtbC0yMDE4LTEyLTEw?organizationId=mymid
Note that the request target and the endpoint both have an ID and a querystring.
Prefix
https://
Host
apitest.cybersource.com
Request Target
/sfs/v1/files/
ID
UGF5bWVudEJhdGNoRGV0YWlsUmVwb3J0LnhtbC0yMDE4LTEyLTEw
Querystring
?organizationId=mymid
The following example shows signature Parameters for IDs and querystrings. During the signature Parameter generation, the request target must contain the full querystring.
host:
apitest.cybersource.com
date: Thu, 13 Dec 2018 01:42:46 GMT (request-target): get /sfs/v1/files/UGF5bWVudEJhdGNoRGV0YWlsUm Vwb3J0LnhtbC0yMDE4LTEyLTEw?organizationId=mymid v-c-merchant-id: mymid