sasjs request¶
The sasjs request
command enables developers to call SASjs web services from the commandline.
Prerequisites¶
Before using this command, you will need to install the SASJS CLI and add a deployment target.
sasjs request¶
This will create a session and execute the relevant SAS service. The output will be returned as a file in the current directory.
Syntax¶
sasjs request <sasProgramPath> [additional arguments]
sasProgramPath
- if this has a leading slash (eg /Public/app/folder/servicename) then it must be the full path. If it is a relative path (eg path/servicename) then it will be pre-pended with the appLoc - defined in the config JSON file.
Additional arguments may include:
-
--target
(alias-t
) - the target environment in which to deploy the services. If not specified, the first target will be used instead. The target can exist either in the local project configuration or in the global .sasjsrc file. -
--data
(alias-d
) - (optional) The path to ajson
file containing the input data passed into the request. -
--config
(alias-c
) - (optional) The path to ajson
file containting the config to be used when executing a request.
data structure¶
The input data is structured as follows:
{
"tablewith2cols1row": [{
"col1": "val1",
"col2": 42
}],
"tablewith1col2rows": [{
"col": "row1"
}, {
"col": "row2"
}]
}
Examples¶
# run a SAS Service without inputs, using the default target
sasjs request /Public/app/myApp/common/appinit
# run a SASjs web service with inputs and a config file
sasjs request common/getdata -d ./dataFile.json -c ./configFile.json -t myTarget