Sandbox
You can try most API products in the freely accessible sandbox environment. Sandbox APIs implement the same OpenAPI specifications used for Live APIs to ensure a similar integration experience. However not all sandbox APIs can be used to fully qualify and test your application because some sandbox APIs only return static responses, which is in a non-business meaningful way.
APIs not provided by Swift may not be available in the sandbox. You can find out whether the sandbox can be used for functional testing for the API of your interests under API Guides.
Postman collections
The API calls available in the sandbox are shown in postman collections. You can view all the collections in the public workspace: Swift API Sandbox Collections. Postman collection linked to the specific API can be found under API Guides.
We strongly recommend forking the collection to be notified when enhancement and bug fixes are made to the collection. Alternatively you can simply view the collection in "read-only" mode. Importing a static copy of the collection is another option however you will not be notified when change happens and you will need to re-import the latest collection to see the changes.
View Collection
This option opens a tab in your browser, directing you to the Swift API Sandbox Collections workspace. You can inspect all the available API calls. However, you will not be able to make any API call. The option for viewing is read-only.
Fork Collection
This option opens a new tab in your browser. If you are logged in to your postman Account, then it will bring up a form to let you set the label, workspace, and notification settings for your fork. On clicking Fork Collection the fork is added to your specified workspace. With a fork, you will be able to send API calls to the sandbox, stay updated on the latest changes, and collaborate through Pull Requests. For more information about forks, please see Fork collections, environments, and Flows in Postman.
Using Postman collection
Now that you have a Postman Collection in your workspace, here are a few things for you to know.
Collection variables
Each Postman Collection comes with its own set of pre-defined variables. These variables can be applied to any call within the collection. At the root folder of the Postman Collection, select the Variables tab to locate the pre-defined variables as the following.
- consumer-key
- consumer-secret
Replace the values with the consumer-key and consumer-secret from the app that you have created. Make sure to click the Save button on the top right after updating the values.
- sandbox-private-key
- sandbox-certificate
sandbox-private-key and sandbox-certificate are retrieved automatically when the authorisation API call is made. You can use as is.
- util-lib
util-lib contains the function that handles signing using JSON Web Key (JWK).
- server
server is always sandbox.swift.com.
Authorization
In the Authorization tab of the collection, Bearer Token is selected as the Auth Type. The Token value is defined in a collection variable access_token. This variable is set by the post-response script after the authorisation API call response is returned.
Scripts
Pre-request and post-response scripts are located in the Generate Token API call inside the Authorization folder.
Access sandbox
Refer to Authentication to learn how to call the Authorisation API to gain access to the API Sandbox. You can expect the same behaviour when you move to Pilot or Live environments. To get started, you can use the dedicated sandbox credentials below to get authenticated and authorised to call the sandbox APIs. After you have successfully tested the APIs in the sandbox, swap the credentials with your Pilot or Live credentials and start making the API calls in Pilot or Live environments.
Sandbox credentials for Password grant type
| Sandbox credentials | Value | Descriptions |
|---|---|---|
| username | sandbox-id | Use in place of License ID. |
| password | sandbox-key | Use in place of License Secret. |
Sandbox credentials for JWT Bearer grant type
| Sandbox credentials | Value | Descriptions |
|---|---|---|
| Self-signed certificate in PEM format | Private Key (PEM encoded) Certificate (PEM encoded) | For using in Swift zero-footprint postman collection. |
| Self-signed certificate in JKS format | For using with Swift SDK or Swift Microgateway. |
- Apart from using the self-signed certificate provided above, any user-generated certificates MAY be used (including self-signed certificates), or standard CA-signed certificates.
- Regardless of certificate issuer, the full certificate chain is NOT verified in the current Sandbox OAuth implementation. The validity period of the certificate is also ignored.
- Self-signed certificates like these MAY NOT be used in Pilot or Live environments. Swift-issued certificates MUST only be used in Pilot and Live.
- The password for JKS is 'password'.