Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mv_createwebservice.sas File Reference

Creates a JobExecution web service if it doesn't already exist. More...

Go to the source code of this file.

Detailed Description

Code is passed in as one or more filerefs.

%* Step 1 - compile macros ;
filename mc url
  "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;

%* Step 2 - Create some code and add it to a web service;
filename ft15f001 temp;
parmcards4;
    %webout(FETCH) %* fetch any tables sent from frontend;
    %* do some sas, any inputs are now already WORK tables;
    data example1 example2;
      set sashelp.class;
    run;
    %* send data back;
    %webout(OPEN)
    %webout(ARR,example1) * Array format, fast, suitable for large tables;
    %webout(OBJ,example2) * Object format, easier to work with ;
    %webout(CLOSE)
;;;;
%mv_createwebservice(path=/Public/app/common,name=appinit)

Notes: To minimise postgres requests, output json is stored in a temporary file and then sent to _webout in one go at the end.

SAS Macros

Parameters
[in]path=The full path (on SAS Drive) where the service will be created
[in]name=The name of the service
[in]desc=The description of the service
[in]precode=Space separated list of filerefs, pointing to the code that needs to be attached to the beginning of the service
[in]code=Fileref(s) of the actual code to be added
[in]access_token_var=The global macro variable to contain the access token
[in]grant_type=valid values are "password" or "authorization_code" (unquoted). The default is authorization_code.
[in]replace=(YES)Select NO to avoid replacing any existing service in that location
[in]adapter=the macro uses the sasjs adapter by default. To use another adapter, add a (different) fileref here.
[in]contextname=Choose a specific context on which to run the Job. Leave blank to use the default context. From Viya 3.5 it is possible to configure a shared context - see https://go.documentation.sas.com/?docsetId=calcontexts&docsetTarget=n1hjn8eobk5pyhn1wg3ja0drdl6h.htm&docsetVersion=3.5&locale=en
[in]mdebug=(0)set to 1 to enable DEBUG messages
Version
VIYA V.03.04
Author
Allan Bowe, source: https://github.com/sasjs/core

Definition in file mv_createwebservice.sas.