Test
Test REST APIs, their resources, and parameters before you implement REST calls. When you test, you need an application to interact with the REST API. You can also use cURL commands or REST clients to test REST APIs before you implement them in your application.
Testing with cURL
cURL is a command-line tool for transferring data using URL syntax. cURL options to test REST APIs are listed in the following table:
Option | Description |
-d |
Sends the specified JSON request body to the server. If
you begin the data with the |
-H |
Specifies an extra HTTP header in the request. To specify
multiple headers, precede each header with the |
-output {file} |
Writes the output to a file. |
-X |
Specifies the request method to use when communicating with the HTTP server. The default method is GET. |
The following table shows examples of GET
, PUT
, and POST
operations using
cURL:
Operation | cURL Command |
Use |
curl -X GET -H "Authorization:Bearer {access-token}"
https://{host}:{port}/spms/v2/ships/{ship-id}/borderControls/ees/guestManifestLists |
Use |
curl -X PUT -H "Authorization:Bearer {access-token}"
-H "Content-Type: application/json" -d "{request payload}""
"https://server:port/spms/v2/ships/{shipId}/configurations/eesConfigurations" |
Use |
curl -X POST -H "Authorization:Bearer {access-token}"
-H "Content-Type: application/json" -d @example_request_payload.json
https://your_organization.com:port/spms/v2/ships/{shipId}/borderControls/ees/manifests |
Testing with REST Clients
You can test REST services using the Advanced REST Client.
The following table
shows examples of GET
, POST
, and PUT
operations using a REST client:
Operation | Response/Payload |
Get ship properties
|
|
Create EES Request file
|
Payload:
Response:
|
Update EES Response file
|
Payload: {EES Response File} Response: OK |