I’ve said it before and I’ll say it again - SAS is an unparalleled platform for lightning fast development of enterprise-grade, business focused web applications. Not least because it comes pre-installed with a Web Server and an incredibly powerful Application Server for building the backend services - known as Stored Processes.
In order to build robust, scalable Stored Process Web Applications it’s imperative to be able to test these services in an automated fashion - eg from your test server or local machine, using a test framework like jenkins or directly with shell scripts. If you have IWA / SSO configured in SAS then this is straightforward - simply call the URL. However if you are connecting to a machine outside your intranet, or if passwords are required for some other reason, then the following code snippet will be helpful.
curl -v -L -c cookiefile -b cookiefile \ -d "_program=$STP&_username=$USERNAME&_password=$PASSWORD" \ https://yourdomain.com/SASStoredProcess/do
Things to note:
- A cookiefile is used so that the session token can be written (
-c) and subsequently read (
-b) by the SASLogon redirect.
_passwordparameters are used to authenticate (see docs)
-vfor verbose logging,
-Lto tell curl to follow the redirect (SASLogon) location
> filename.extor using the