Progress ID has multiple Request IDs | XM Community
Skip to main content

I have code that uses a REST API in SAS to request a survey, prompting a request id, and then to and then “get” the data via PROC HTTP.  I’ve found that over the past 2-3 weeks, the code is not pulling the latest data.  I’d run the code to request the survey, wait over an hour, and then try to “get”, but noticed that despite survey ID and Progress ID being the same, the http pulls post different request IDs and the data is not the latest.  Hoping someone call help me understand where I’m going wrong?


    %put GetSurveyID for &survey_nm.; run;
    %GetSurveyID(&Survey_Nm.); run;   
    %put The Survey ID for the Survey Name (abbreviation = &survey_nm.) is &=SurveyID; 

 /* Need to provide the SurveyID (see previous step)  in order to get the RequestID as well as the ProgressID */
    %put Proc HTTP to create Request;
    options set=SSLREQCERT="allow";
    filename rsp temp;
    proc http
    url="https://sjc1.qualtrics.com/API/v3/surveys/&SurveyID./export-responses/"
    method= "POST"
    in='{"format" : "csv"}'
    out=rsp;
     headers   
       'x-api-token'= "&QToken."
       'Content-Type'='application/json';
    run;
    /* Let the JSON engine do its thing */
    libname RSP JSON fileref=rsp;
    title4 "Automap of JSON data for the Survey ID of interest: &SurveyID.";
    /* examine resulting tables/structure */
    proc datasets lib=RSP; quit;


    title3 '';
    Data ReponseExport;
    set rsp.alldata;
    if p2 = 'progressId' then call symputx('ProgressID',strip(value),'g');
    if p2 = 'requestId' then call symputx('RequestID',strip(Value),'g');
    run;
    title3 "ProgressID=&ProgressID. and RequestID=&RequestID.";
    proc print Data=ReponseExport; run;
    %put &=ProgressID &=RequestID; run;


/******************************************************************************************/    
*<<Allow time for Qualtrics to process the prior request and prepare the data for SAS>>;
data progress;
       call sleep(3600, 1); *seconds hold;
       
*<<Check status of run>>;
Title3 '/* GET REPONSE EXPORT PROGRESS */';
    options set=SSLREQCERT="allow";
    filename progr temp;
    proc http
    url="https://sjc1.qualtrics.com/API/v3/surveys/&surveyId./export-responses/&ProgressID."
    method= "GET"
    out=progr;
     headers   
       'x-api-token'= "&QToken."
       'Content-Type'='application/json';
    run;

 

**the request_id in the above does not match that in the top section;

Be the first to reply!

Leave a Reply


OSZAR »