BookmarkSubscribeRSS Feed
harshSASCIM
Calcite | Level 5

Hey All,

 

I am having a demo Web Application from SAS.

I am doing and R&D for accessing SAS Web Apps data without accessing it using SAS Viya API.

 

I am facing an issue where I have to register a client and to get the token for the register client to access the APIs.

 

I got the one trail Web App from your SAS which is https://pdcesx18027.sas.com

Now to connect with the API to access from other apps such as postman or any

web app, I need to register the client and get the token to access the other APIs too.

 

My issue is that I am not able to register the client as described in the URL of yours.

https://developer.sas.com/apis/rest/Topics/#configuring-your-sas-environment-for-api-use.

 

I tried almost everything to get the token to access it but I am not able to register the client

For the given demo URL.

 

Is it possible to register a client in a demo app? 

Because I didn't find any configuration in Environment Manager to register the client in demo app.

 

Can any one help me out for this one?

5 REPLIES 5
AllanBowe
Barite | Level 11

Hi,

 

First, to get the api key, the operating system account must be an admin (in order to access the consul token).

 

Just run the following code in SAS Studio:

/* Load macros. If you don't have internet access, download and compile. */
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
%inc mc;

/*  Register client. Admin Task. */
 %mv_registerclient(outds=client) 

/* open the URL from the log, click "open id" and paste the Authorization Code below. */ 
%mv_tokenauth(inds=client,code=wKDZYTEPK6) 

 

NOTE - the names of these macros have been updated in v2 of MacroCore to be more intuitive.  I've updated the example above.

 

Another option is to use the SASjs Viya Token generator (assumes your Job Execution service is running with an administrator account):  https://sasjs.io/apps/#viya-client-token-generator

 

More SAS Macros for interacting with the Viya APIs are available on github (MIT licence) here:  https://github.com/sasjs/core

 

A video showing how to build a web app on SAS in just 5 minutes, using this technique, is available here:

https://www.youtube.com/watch?v=vSNBea_M8yU

 

 

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
harshSASCIM
Calcite | Level 5

Hey @joeFurbee ,

Thank you so much for your quick response.

I tried the code you gave me but Its giving some errors

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
75
76 /* Load macros and obtain app token. Admin Task. */
78 %inc mc;
ERROR: The connection has timed out..
ERROR: Cannot open %INCLUDE file MC.
79 %let client=new%sysfunc(ranuni(0),hex16.);
80 %let secret=MySecret;
81 %mv_getapptoken(client_id=&client,client_secret=&secret)
-
180
WARNING: Apparent invocation of macro MV_GETAPPTOKEN not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.
82
83 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
84
85 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
96

frankly speaking I am having no idea about SAS. 

My simple requirement is to get data through SAS API so didn't created any SAS Web App

just got the example or demo app from the SAS itself.

Its not having any admin console, nor configuration. It's just having SAS Drive.

 

If you want the credentials for that demo app I can provide It to you.

So, you can look into it and suggest me something on it.

joeFurbee
Community Manager

Hi @harshSASCIM

Which free trial did you sign up for? Can you provide the page where you signed up? It very well could be that this trial does not support API access. But I can't determine that until I know which trial you are using.

 

Thanks,

Joe


Join us for SAS Community Trivia
SAS Bowl XL, SAS Innovate 2024 Recap
Wednesday, May 15, 2024, at 10 a.m. ET | #SASBowl

harshSASCIM
Calcite | Level 5

hey @joeFurbee,

 

I got the trial from the sas itself.

Which is currently not available on the SAS due to they are not having business.

Now they are just providing the trial for the COVID-19 reset of the trail are removed temporarily.

https://www.sas.com/en_in/trials.html you can refer the page.

 

Here is a credential of my demo URL.

URL: https://pdcesx18027.sas.com
UID: harsh@cimcon.com
PSWD: Cim@1234

 

You can use it. As its not having any sensitive data.

joeFurbee
Community Manager

Hi @harshSASCIM

You can also refer to this blog post Authentication to SAS Viya: a couple of approaches. I outline the client registration steps there.

 

Thanks,

Joe


Join us for SAS Community Trivia
SAS Bowl XL, SAS Innovate 2024 Recap
Wednesday, May 15, 2024, at 10 a.m. ET | #SASBowl

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1071 views
  • 2 likes
  • 3 in conversation