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 @ sign, the rest of the request body should be a file name from which the data is read.

-H

Specifies an extra HTTP header in the request. To specify multiple headers, precede each header with the -H option.

-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 GET to retrieve all reservations

curl -X GET -H "Authorization:Bearer <access-token>" https://<host>:<port>/spms/v1/reservations

Use PUT to update an amenity

curl -X PUT -H "Authorization:Bearer <access-token>" -H "Content-Type: application/json" -d 'request payload' "https://server:port/spms/v2/ships/<ship-id>/configurations/amenityCodes/<amenity-code>"

Use POST to add new excursion to catalog

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/<ship-id>/configurations/excursions/bookableTours

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

https://your_organization.com:port/spms/v2

/userDetails/me/shipProperties

{
                  "shipRecordID": 17,
                  "shipReferenceID": "186-117",
                  "shipType": 1,
                  "shipEnabled": true,
                  "shipName": "ORCL xSight",
                  "shipID": 186000000117,
                  "shipCode": "OXS117"
              }

Register a tenderboat to a gateway

https://<host>:<port>/spms/v2/ships/<ship-id>

/gatewaySecurity/tenderBoatGateway

Payload:

{
                  "tenderBoatId": 1061,
                  "locationCode": "BS-NAS",
                  "direction": 1
                }

Response:

{
                  "dateTime": "2022-02-22T20:22:02.022022",
                  "tenderBoatName": "Opus",
                  "locationName": "Nassau",
                  "tenderBoatStatus": true,
                  "tenderBoatId": 1061,
                  "id": 1301,
                  "locationCode": "BS-NAS",
                  "direction": "1"
                  }

Disable a questionnaire category

https://<host>:<port>/spms/v1

/guest/1077157

{
                  "viewOnly": false,
                  "id": 22,
                  "categoryName": "Health",
                  "enabled": false
              }