HTTP 403 error when using CAS REST api

Accepted Solution Solved
Reply
Contributor
Posts: 29
Accepted Solution

HTTP 403 error when using CAS REST api

Hello, 

 

I am a new user for sas viya and now I am trying to get familar with it on the remote desktop using pdc image. I am tring to create a session using the curl method showed in this link: https://developer.sas.com/apis/cas/rest/v3.0.1/apidoc.html, which is "

curl -n -X PUT http://cloud.example.com:8777/cas/sessions  

I tried to use http://sasserver.demo.sas.com:8777/cas/sessions and I got an HTTP 403 error there. May I ask if somebody know why is that? It's just simply I don't have the permission or it is because I need to use some other link?

 

Thanks!


Accepted Solutions
Solution
‎09-12-2017 03:56 PM
SAS Employee
Posts: 242

Re: HTTP 403 error when using CAS REST api

@xiaoys0725,

 

You get HTTP 403 because you are providing no credentials.  You can send in Basic Auth credentials (in real-world, only advisable over HTTPS) or an OAuth token in theAuthorization header.

View solution in original post


All Replies
Solution
‎09-12-2017 03:56 PM
SAS Employee
Posts: 242

Re: HTTP 403 error when using CAS REST api

@xiaoys0725,

 

You get HTTP 403 because you are providing no credentials.  You can send in Basic Auth credentials (in real-world, only advisable over HTTPS) or an OAuth token in theAuthorization header.

Contributor
Posts: 29

Re: HTTP 403 error when using CAS REST api

Thanks but may I ask what is the credentials for sasserver.demo.sas.com:8777/cas/sessions? 

Contributor
Posts: 29

Re: HTTP 403 error when using CAS REST api

Hello, I solved the problem, thank you! But I got another question: is there a CAS Rest api for the cas table? Or is there anyway that I can get data from caslib directly?

SAS Employee
Posts: 242

Re: HTTP 403 error when using CAS REST api

@xiaoys0725,

 

Yes, fetch action fetches rows from a table or view.

Contributor
Posts: 29

Re: HTTP 403 error when using CAS REST api

Thank you. I tried fetch and then it works. But I came across another issue, I am trying to use angularjs to get access to the data, then I need to upload my html files somewhere on the server so I can get access to. I created a new file folder called"test" by sasstudio in /home/sasdemo, and upload my html files there. But I found I cannot open it by "sasserver.demo.sas.com/home/sasdemo/test/test.html". Do you know if there is a way to upload my html file on the server so that I can get access to my web page through URL?

SAS Employee
Posts: 242

Re: HTTP 403 error when using CAS REST api

@xiaoys0725,

 

Do you know if there is a way to upload my html file on the server so that I can get access to my web page through URL?

Yes, in /var/www/html. You need to have root (or sudo) access to the server.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 184 views
  • 0 likes
  • 2 in conversation