Proc http with https url

So I want to use Google Url shortener Api and I am trying to use

proc http

      

so when i run this code

filename req "D:\input.txt"; 
filename resp "D:\output.txt";

proc http 
url="https://www.googleapis.com/urlshortener/v1/url" 
method="POST"   
in=req         
ct="application/JSON" 
out=resp       
;run;

      

(where D: \ input.txt looks like {"longUrl": " http://www.myurl.com "}) everything works in my house SAS 9.3 base. But, at work, on EG 4.3, I get:

NOTE: The SAS System stopped processing this step because of errors.

      

and impossible to debug. After searching on google, I found that I need to install a java system variant like this

-jreoptions (-Djavax.net.ssl.trustStore=full-path-to-the-trust-store -Djavax.net.ssl.trustStorePassword=trustStorePassword)

      

But where can I get a "trusted service certificate" - and a password to it?

Edit: As I noticed in the comments below, my SAS job is installed on the server, so I didn't have direct access to the config. Also, it is not recommended to change the server configuration. So, I'm trying to google even more and found a nice solution with cUrl, no X command (because it blocks in my EG). Equivalent syntax:

filename test pipe 'curl -X POST -d @D:\input.txt https://www.googleapis.com/urlshortener/v1/url --header "Content-Type:application/json"';

data _null_;
infile test missover lrecl= 32000;
input ;
file resp;
put _infile_;   
run;  

      

Hope this helps someone

+3


source to share


1 answer


  • Where to get the certificate Open the URL from which you want to get the certificate through Chrome. Click on the lock file in the URL bar, go to the "Details" tab and click "Save as file" in the lower right corner. You will need to know which trust store you are going to use at this stage. See Next Step.
  • The password and trust store are up to you. In most cases, this is nothing more than an encrypted zip file. There are many tools that allow you to create a trust store, encrypt it, and import certificates into it. The choice will depend on which OS you are using. There are some OS independent Java tools like Portecle. It allows you to define different trust stores on different OS and you can manage them remotely.


Regards, Vasilij

+2


source







All Articles