4.1 Using cURL with Spatial Studio REST APIs

cURL is a powerful command line tool available on many platforms for sending and receiving URL requests to a remote server.

When accessing or invoking a REST endpoint, the curl command follows a specific format.

For example, consider the following request to retrieve the Spatial Studio version:

HTTP GET Request
curl -k https://localhost:4040/spatialstudio/oauth/v1/softwareVersion \
 --header "Authorization: Bearer <MY_TOKEN>"

The options used in the preceding request are explained as follows:

  • -k: To indicate that the cURL request must accept the self-signed SSL certificate used by a Quick Start Spatial Studio instance.
  • –-header: To set the Spatial Studio access token as a bearer token header in the request.

    Note that the keywords Authorization: (including the colon and whitespace) and Bearer must be entered as is, with the entire value for the -- header option enclosed in double quotes. The variable <MY_TOKEN> represents the actual token string which must be provided in one unbroken line.

Note that the URL in the request uses oauth/v1 as path segments. If you accidentally use api/v1, then the response returns the web application login page in HTML.

The following sections explain with a few examples on how to invoke a REST API endpoint using cURL: