A collection of examples demonstrating then use of restaf in nodejs The demos cover typical SAS software usages - running datastep, running cas actions, accessing VA reports etc...
Please review the source code to see how restaf is used to achieve the desired goal with minimal coding.
example:
git clone https://github.com/sassoftware/restaf-demos -b restaf-demos
cd restaf-demos
npm install
To run this application you need to do the following:
Ask your system administrator to give you a clientid and clientSecret appropriate for password flow.
A note on password flow: With the advent of TFA you should start transistioning away from using userid+password to run the examples in this repository. Instead use a saved token to execute these programs.
You can use the standard sas-cli.
sas-viya auth loginOr you can use the newer version which uses authorization_code flow to get the token
sas-viya auth loginCodeSave the token in some secure place (the .sas directory is a good place)
The .env file is the way to specify configurations.
VIYA_SERVER= <your viya server url : ex: http://myviya.sas.com>
# Preferred way
# TOKENFILE=<path to a persisted viya authentication token>
# ex: TOKENFILE=../../token
## Alternate setup: Will work until the use of password flow is phased out.
# CLIENTID=sas.ec
# CLIENTSECRET=
# USER=xxx
# PASSWORD=ppp
# if Viya server still has the unsigned certificate and your protocol is https
NODE_TLS_REJECT_UNAUTHORIZED=0
npm test testnamenpm debug testnameThen use your favorite nodejs debugger. I use the chrome://inspect on Google chrome.
- 
addServices - initialization of specific Viya Services 
- 
appdata - adding and retrieving app specific information from restaf 
- 
casds - executing datastep in CAS 
- 
casEcho - executing echo action 
- 
casFetch - fetching data from CAS 
- 
casSentiment - sentiment analysis in CAS 
- 
casSessions - creating CAS sessions 
- 
casTables - list fileinfo for all tables in all caslibs 
- 
casUpload - upload a csv file and operate on it 
- 
casUploadAstore - upload a astore to cas 
- 
casUploadImages - upload images to file service 
- 
computeds - execute a compute service 
- 
computedsEasy - accessing compute service using restaflib 
- 
logon - logon to a Viya server 
- 
paginate - paginate thru the file service and list the file names 
- 
reportElement - prints the named elements in a VA report 
- 
reportImage - generate an image(svg) for a report 
- 
reportList - list the names of all the reports 
- 
request - access an external url 
- 
submit - run a job in the background. 
- 
submitAction - run a cas job in the background 
- 
submitcasl - similar to submitAction for runcasl 
- 
reportList - list all the reports 
These have been removed since they have not been kept up with changes to AWS serverless functions.