BookmarkSubscribeRSS Feed

Can I Call CAS Actions Using REST APIs?

Started ‎12-01-2021 by
Modified ‎02-28-2022 by
Views 6,350

Call CAS Actions Using REST APIs.jpgSAS® Viya® uses CAS to perform tasks using CAS actions. CAS actions can load and transform data, compute statistics, perform analytics and create output. They can be called from a variety of programming languages (CASL, Python, R, etc.). During this Ask the Expert session, we’ll explore calling CAS actions via REST using the CAS REST APIs. 

 

Watch the webinar

 

You will learn how to:

  • Explore/navigate CAS action sets and actions documentation.
  • Create properly formatted REST API calls to call CAS actions.
  • Use CAS actions APIs alongside SAS Viya APIs.
  • String multiple CAS actions together, creating end-to-end use cases.

 

The questions from the Q&A segment held at the end of the webinar are listed below and the slides from the webinar are attached.

 

Q&A

I can’t find append action for table action set in the documentation?

The newest documentation includes the append action; older versions do not (SAS 9.4 / Viya 3.4 and 3.5 does not have it).

 

What are the table limits that could be sent to CAS? Would 40K observations by 120 variables work?

If you’re using the upload action that’s streaming data from your client to CAS, that would totally depend on your bandwidth and your environment. If you had 40,000 records and 120 variables for each of those, you could probably do that via the upload, but there are also other actions you could use if you have a file. You could have a CSV file or a SAS data set to upload and you could use the upload table action at the point which would not be using the upload action, it would be using the upload table action. And that would do that a lot quicker. So, the upload action that I used today was just a quick way to get a CSV file in there, but there are many other actions within those action sets that you can use to upload data. How fast it gets up there would really depend on you environment.

 

How does CAS deal with CSV upload errors? I.e. wrong date format, string too long, etc.

If you’re using the table upload, there are many parameters that you can set when you are uploading that data and a lot of those parameters can handle formatting. What kind of informats am I expecting? If you’re familiar with SAS programming, you have informats which is where you are saying, “What is the format of the data that I am bringing in?” Those parameters are available on the CAS actions as you’re bringing that data in so you can do some data manipulation as you’re bringing that data in. I should mention though that once you get the data into SAS that there are many transformation and data management CAS actions. Once you get the data in, you can do a lot of data manipulation with those tables as well.

 

Is Streaming Action possible?

There are CAS actions related to Event Stream Processing. There are a whole set of APIs for Event Stream Processing as well. So, I encourage you to go look at the documentation for those. SAS Product -> Event Stream Processing, under the IoT umbrella, you should be able to do the streaming of the data there.

 

How do you escape special characters in CAS body payload?  i.e. Setting up filter with & signs, colons, quotes etc?

You would definitely want to be familiar with your data on the client side and then be able to set those parameters properly as you’re doing your table upload that will handle those various informats as you upload your data.

 

How do I handle authentication to the CAS server?

You need an access token. I’ve done a complete webinar on authentication with SAS Viya, so please check that out. Once you have the access token, you use that and then you create a CAS session. You have to build one on top of the other to connect CAS, you need that access token. And then once you connect to CAS, you can create a session, and then all of your subsequent calls can be used in that session.

 

What are the differences between SAS Viya REST APIs and CAS REST APIs?

SAS Viya APIs target enterprise application developers (who may or may not be versed in analytics), who intend to build on the work of model builders and data scientists. These developers want to deliver apps based on SAS Viya technology -- for example, to call an analytical model to score data.

Meanwhile, Cloud Analytic Services (CAS) REST APIs are used by data scientists and programmers (who are decidedly adept at analytics) and administrators, who need to interact with CAS directly and are knowledgeable about CAS actions. CAS actions are the building blocks of analytical work in SAS Viya.

 

Recommended Resources

REST APIs for Cloud Analytics Services (CAS)

SAS REST APIs blog series

CAS Actions and Action Sets Documentation

55% Off SAS Certification Exams

 

Want more tips? Be sure to subscribe to the Ask the Expert board to receive follow up Q&A, slides and recordings from other SAS Ask the Expert webinars.  

Contributors
Version history
Last update:
‎02-28-2022 11:28 AM
Updated by:

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Article Tags