<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: proc http and passing the surveyid in the url in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-http-and-passing-the-surveyid-in-the-url/m-p/854604#M42026</link>
    <description>&lt;P&gt;I would start with using POST vs GET in your call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some sample code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename resp temp;&lt;BR /&gt;filename outPP temp;&lt;/P&gt;
&lt;P&gt;filename sasPgm 'C:\repos\StoredPrograms\DemoStoredProgram.sas';&lt;/P&gt;
&lt;P&gt;/*===================================================================== ;&lt;BR /&gt;* Executes SAS code&lt;BR /&gt;* curl -X POST "&lt;A href="http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile" target="_blank"&gt;http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile&lt;/A&gt;?&lt;BR /&gt;* sasMachine=Any&amp;amp;email=alan.churchill%40acmeinc.com" &lt;BR /&gt;* -H "accept: text/plain" &lt;BR /&gt;* -H "Content-Type: multipart/form-data" &lt;BR /&gt;* -F "sasFile=@DemoStoredProgram.sas;type=application/x-sas"&lt;BR /&gt;*=====================================================================*/ ;&lt;/P&gt;
&lt;P&gt;proc http&lt;BR /&gt;url = '&lt;A href="http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile?sasMachine=Any&amp;amp;email=alan.churchill%40acmeinc.com" target="_blank"&gt;http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile?sasMachine=Any&amp;amp;email=alan.churchill%40acmeinc.com&lt;/A&gt;'&lt;BR /&gt;method="POST"&lt;BR /&gt;in = sasPgm&lt;BR /&gt;ct = "multipart/form-data"&lt;BR /&gt;;&lt;BR /&gt;headers "Accept"="text/plain"&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jan 2023 15:12:55 GMT</pubDate>
    <dc:creator>AlanC</dc:creator>
    <dc:date>2023-01-19T15:12:55Z</dc:date>
    <item>
      <title>proc http and passing the surveyid in the url</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-http-and-passing-the-surveyid-in-the-url/m-p/854461#M42024</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am a new user of proc http in SAS.&lt;/P&gt;
&lt;P&gt;I have tried the code below and it works&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options set=SSLREQCERT="allow";
filename resp temp;
 
PROC HTTP
    METHOD="GET"
    URL= 'https://ca1.qualtrics.com/API/v3/surveys'
    OUT=resp;
    headers
    'x-api-token'= '***************ddssXDlLVfJUwJOJfD74l0sc1';
run;
 
/* Let the JSON engine do its thing */
libname posts JSON fileref=resp;
title "Automap of JSON data";
 
/* examine resulting tables/structure */
proc datasets lib=posts; quit;
proc print data=posts.alldata; run;

data Basic_survey_info (drop=ordinal_result ordinal_elements);
set posts.result_elements;
obs=ordinal_elements;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From the table Basic_Survey_info, one of the survey id is equal to&amp;nbsp;SV_ahhZznQMwSAyrGK&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With this information I would like to execute the script below but in SAS. How to do that ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sl-flex"&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token function"&gt;curl&lt;/SPAN&gt;&lt;SPAN class="token plain"&gt; --request POST &lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="sl-flex"&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token plain"&gt; --url &lt;A href="https://yul1.qualtrics.com/API/v3/surveys/surveyId/export-responses" target="_blank"&gt;https://yul1.qualtrics.com/API/v3/surveys/surveyId/export-responses&lt;/A&gt; &lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="sl-flex"&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token plain"&gt; --header &lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Content-Type: application/json'&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="sl-flex"&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token plain"&gt; --header &lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'X-API-TOKEN: '&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="sl-flex"&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token plain"&gt; --data &lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'{&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="sl-flex"&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token string"&gt; "format": "csv"&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="sl-flex"&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token string"&gt;}'&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token string"&gt;Whats the url will look like when you the surveyId by it's value ?&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token string"&gt;I have tried this piece of code&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options set=SSLREQCERT="allow";
filename resp TEMP;
%let SurveyId=SV_ahhZznQMwSAyrGK;
proc http
   url="https://ca1.qualtrics.com/API/v3/surveys/&amp;amp;SurveyId./export-responses"
   out=resp;
 headers   
   'x-api-token'= '***********ssXDlLVfJUwJOJfD74l0sc1'
   'Content-Type'='application/json';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;SPAN class="token string"&gt;but I am strill getting an error 404&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token string"&gt;NOTE: 404 Not Found&lt;BR /&gt;NOTE: PROCEDURE HTTP used (Total process time):&lt;BR /&gt;real time 0.30 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token string"&gt;&lt;SPAN class="token string"&gt;More over, how do we convert the information&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;DIV class="sl-flex"&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token plain"&gt;data &lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'{&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="sl-flex"&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&lt;SPAN class="token string"&gt; "format": "csv" in SAS&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="sl-flex-1 sl-break-all"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 18 Jan 2023 22:03:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-http-and-passing-the-surveyid-in-the-url/m-p/854461#M42024</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-01-18T22:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc http and passing the surveyid in the url</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-http-and-passing-the-surveyid-in-the-url/m-p/854604#M42026</link>
      <description>&lt;P&gt;I would start with using POST vs GET in your call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some sample code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename resp temp;&lt;BR /&gt;filename outPP temp;&lt;/P&gt;
&lt;P&gt;filename sasPgm 'C:\repos\StoredPrograms\DemoStoredProgram.sas';&lt;/P&gt;
&lt;P&gt;/*===================================================================== ;&lt;BR /&gt;* Executes SAS code&lt;BR /&gt;* curl -X POST "&lt;A href="http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile" target="_blank"&gt;http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile&lt;/A&gt;?&lt;BR /&gt;* sasMachine=Any&amp;amp;email=alan.churchill%40acmeinc.com" &lt;BR /&gt;* -H "accept: text/plain" &lt;BR /&gt;* -H "Content-Type: multipart/form-data" &lt;BR /&gt;* -F "sasFile=@DemoStoredProgram.sas;type=application/x-sas"&lt;BR /&gt;*=====================================================================*/ ;&lt;/P&gt;
&lt;P&gt;proc http&lt;BR /&gt;url = '&lt;A href="http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile?sasMachine=Any&amp;amp;email=alan.churchill%40acmeinc.com" target="_blank"&gt;http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile?sasMachine=Any&amp;amp;email=alan.churchill%40acmeinc.com&lt;/A&gt;'&lt;BR /&gt;method="POST"&lt;BR /&gt;in = sasPgm&lt;BR /&gt;ct = "multipart/form-data"&lt;BR /&gt;;&lt;BR /&gt;headers "Accept"="text/plain"&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 15:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-http-and-passing-the-surveyid-in-the-url/m-p/854604#M42026</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2023-01-19T15:12:55Z</dc:date>
    </item>
  </channel>
</rss>

