BookmarkSubscribeRSS Feed

Jump Start a REST API server for your SAS Viya programs

Started ‎03-12-2021 by
Modified ‎03-12-2021 by
Views 9,854

Preamble

Hi fellow SAS Viya Programmers - Do you want to enable your users to access your SAS programs using REST API? Do you want to deliver your programs in a container? Then read on!

 

Introduction

This article presents an easy way for SAS programmers to create a REST API server to front their SAS Viya Programs - including data steps, procedures, CAS Actions or CASL programs.

 

Full documentation for the create-viya-api tool is located on GitHub. Additionally, please follow this link if you'd like to see the details of the underlying server code. The entire project is based on restaf - An Easy Button To Access SAS Viya Using SAS Viya REST APIs.

 

Below is a short introductory video demonstrating the functionality.

 

 

Key Features

 

  1. Define your API end points using JavaScript

  2. Authentication

    • Accepts a valid SAS Viya token
    • If called from an authenticated browser session it will get a token from SAS Viya
    • By design it does not support client credentials(userid, password) - since bullets 1 and 2 are the more common use cases.
  3. In your handler (where you process the request), you have access to a context object with the following:

    • The current valid token
    • All the standard http artifacts - path, query, payload, headers etc
    • Access the REST end points via swagger, web applications and any scripting environment
  4. Deploy the server in a Docker container

  5. The starter example has the following end points to jump start your development. These cover some basic scenarios.

    • CAS actions
    • CASL statements
    • Compute service with the user-supplied code
    • Specific program saved in the "server". In this example, the code is in a file on the API server, but in a real deployment this code will be in some repository

 

Next Steps

Please try it out for yourself. And be sure to send your feedback - good or bad. 

 

SAS Documentation

Please refer to the SAS Support site for full documentation.

Version history
Last update:
‎03-12-2021 11:15 AM
Updated by:
Contributors

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags