BookmarkSubscribeRSS Feed

Jump Start a REST API server for your SAS Viya programs

Started ‎03-12-2021 by
Modified ‎03-12-2021 by
Views 7,284

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

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags