NAV Navbar
Home icon
SAS Viya Orders REST APIs
shell javascript python go

Getting Started



The SAS Viya Orders API provides programmatic access to the deployment assets, certificates, and license files that are served at the My Viya Orders tab in My SAS. You can use the API to script the downloading of the files that are needed for the SAS Viya deployment and update process.

For a command-line interface to this API, see SAS Viya Orders CLI.

Configuring Your SAS Environment for API Use

Obtain Client Credentials

The Orders APIs use OAuth 2.0 with the Client Credentials flow for authentication. You will start by visiting the SAS API Portal to get client credentials for your application. NOTE In examples below, client_id comes from the Key value obtained from the SAS API Portal, while client_secret comes from the Secret value obtained from the SAS API Portal.

Obtain a Temporary Access Token

The client credentials obtained above are to be exchanged for a temporary Bearer token that expires after 30 minutes. The token is used on API endpoint calls to authenticate your application to the API. In order to obtain a Bearer token, you will use the /token API endpoint. When passing your client credentials on an API call, it is recommended by the OAuth 2.0 specification that you do so as an HTTP-Basic Authentication header (described in IETF RFC 2617). This involves base64 encoding a string formed with {client_id}:{client_secret}. The curl utility can do the encoding for you if you use the -u option. NOTE See the lib/authn package in SAS Viya Orders CLI for a Golang example of exchanging base64-encoded client credentials for a Bearer token.

For example, using curl:

client_id = "abcdef"

client_secret = "ghi"

curl -i -H 'Content-Type: application/x-www-form-urlencoded' -u 'abcdef:ghi' \ -X POST '' -d 'grant_type=client_credentials'

HTTP/1.1 200 OK Date: Wed, 29 Jul 2020 21:15:03 GMT Content-Type: application/json Content-Length: 531 Connection: keep-alive Strict-Transport-Security: max-age=31536000; includeSubDomains X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN Content-Security-Policy: default-src 'self' { "token_type" : "Bearer", "access_token" : "jklmnop", "issued_at" : "1596057303202", "expires_in" : "1799", "scope" : "" }

You now have access token jklmnop (see access_token property in the sample output above) to use for authenticating to the Orders APIs for the next 30 minutes.

Making API Requests with an Access Token

Select Your Cadence

NOTE See the Terminology section for formal definitions of cadence name and cadence version. To use the API endpoints that download license files and deployment assets, you will need to know the name and possibly the version of the cadence you wish to use.

If you are patching an existing deployment, then use the cadence name and version that corresponds to what you already have deployed - when you download deployment assets at that cadence, the latest patches to it will be included.

If you are unsure of what cadences are available to your order:

Cadence Selection

See the SAS Viya Operations Guide Concepts FAQ for a more detailed explanation of cadences.

Examples of API Endpoint Usage

These examples use either curl, wget, or Postman to show a variety of options.

Get certificates
Get deployment assets at a specific version of a cadence
Get deployment assets at the latest version of a cadence
Get a license

Get certificates using curl

curl -o {path-and-name-of-output-certificates-file} \ -H "Authorization: Bearer {access-token}" \{orderNumber}/certificates

Get deployment assets at a specific version of a cadence using Postman

Request Deployment Assets

Save Deployment Assets

Get deployment assets at the latest version of a cadence using curl

curl -o {path-and-name-of-output-deployment-assets-file} \ -H "Authorization: Bearer {access-token}" \{orderNumber}/cadenceNames/{cadenceName}/deploymentAssets

Get JWT software license at a specific version of a cadence using wget:

wget -O {path-and-name-of-output-license-file} --header \ -H "Authorization: Bearer {access-token}" \{orderNumber}/cadenceNames/{cadenceName}/cadenceVersions/{cadenceVersion}/license