BookmarkSubscribeRSS Feed
j_l_seagull
Calcite | Level 5

Hi Chris, good idea.

I tried this instead of the last proc http step (see Post 8):

/* try to get folder entities - just to try a GET method

Microsoft API documentation:
url: http://site url/_api/web/GetFolderByServerRelativeUrl('/Shared Documents')
method: GET
headers:
    Authorization: "Bearer " + accessToken
    accept: "application/json;odata=verbose" or "application/atom+xml"

For Proc HTTP:
url="http://&base_url./sites/_api/web/GetFolderByServerRelativeUrl('/Shared Documents')"

*/

proc http
  method='GET'
  url="http://&base_url./sites/_api/web/GetFolderByServerRelativeUrl('/Shared Documents')"
  headerout=headers
  out=resp2
  AUTH_NEGOTIATE
  HEADEROUT_OVERWRITE;
run;
%echofile(headers);

But the resp2-File gives no meaningful answer. Even though the status is 200.

 

HTTP/1.1 200 OK
Server: Microsoft-IIS/7.5
Date: Thu, 08 Jun 2017 13:51:40 GMT
Connection: close

So I definitely have no clue, what happens in this proc http and from where it got the result...

 

JosephHenry
SAS Employee

I am still not clear why you are using 2 form of authentication.

 

You are sending in a Bearer token (I am guessing this is Microsoft Claims based auth)

and are also using NTLM or Kerberos.

 

If your access token is still valid, try just using the token and add AUTH_NONE to your proc statement.

j_l_seagull
Calcite | Level 5

Thank you Joseph.

This is something I don't understand either. The REST-API documentation written by Microsoft told me to send that ' Authorization: "Bearer " + accessToken'  header.

 

So you want me to try this?:

/* prepare the input header: */
data _null_;
file input recfm=f lrecl=1;
  put "Authorization: Bearer &token.";
  put '0d'x'0a'x;
  put "X-RequestDigest: form digest value";
run;


proc http
  method='POST'
  in=input
  url="http://&base_url./sites/_api/web/GetFileByServerRelativeUrl('/ASK-TP-DS/Dokumente/Forms/test_jat.txt')/CheckOut()"
  headerout=headers
  out=resp2
  AUTH_NONE
  HEADEROUT_OVERWRITE;
run;
%echofile(headers);

This results in an empty resp2 and a headers that says:

 

HTTP/1.1 401 Unauthorized
Server: Microsoft-IIS/7.5
SPRequestGuid: 5f57611d-0ef9-4a30-a263-d5db0ca8bdf3
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 14.0.0.7175
X-MS-InvokeApp: 1; RequireReadOnly
Date: Thu, 08 Jun 2017 14:05:35 GMT
Content-Length: 0
JosephHenry
SAS Employee
Ok,



Try not using the bearer token.



I am not an expert in SharePoint, but I have worked with it in the past and know that it can be very odd sometimes (like sending 200 responses with no content)



I would suggest just trying the GET that you were doing before, but remove the Bearer token and try AUTH_NEGOTIATE.


akhozan
Calcite | Level 5

I am trying to connect using Active Directory from Linux SAS to my on Premise SharePoint using CURL. I am able to do the command from my desktop, but am getting 401 authentication errors when trying to authenticate from ssh command line. Would it be easier to me to request a local id, instead of trying to connect with AD?

 

Command:

 

curl -v --NTLM --user $USER -L "URL" --output file.xlsx

 

Error:

< HTTP/1.1 401 Unauthorized
< Server: Microsoft-IIS/8.5
< SPRequestGuid: 6fb9fc9f-e632-1097-77e6-b91901d368ed
< request-id: 6fb9fc9f-e632-1097-77e6-b91901d368ed
< X-FRAME-OPTIONS: SAMEORIGIN
< SPRequestDuration: 71
< SPIisLatency: 0
< WWW-Authenticate: Negotiate
* NTLM handshake rejected
* Authentication problem. Ignoring this.
< WWW-Authenticate: NTLM
< X-Powered-By: ASP.NET
< MicrosoftSharePointTeamServices: 16.0.0.4705
< X-Content-Type-Options: nosniff
< X-MS-InvokeApp: 1; RequireReadOnly
< Date: Mon, 25 Oct 2021 21:45:11 GMT
< Content-Length: 0
<
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 19 replies
  • 10145 views
  • 1 like
  • 4 in conversation