Hello,
I am using a proc http procedure to upload a contact list via an api web site call.
But the issue, I am facing is: it is like the api web site is not able to upload many contacts at the same time. I have upload 10 contacts, one by one so, 10 proc http call.
%do j=1 %to 1 /*&cie_count.*/;
%chkifpathexist(dest&j.);
%if &FEXIST. = 1 %then
%do;
%put the pathname dest&j. exist;
%put %sysfunc(quote(%sysfunc(pathname(dest&j.))));
%put &&DirectoryId&j.;
%put "uploading the consent information for the company : &&cie&j." ;
/* https://api.qualtrics.com/3f3d5290d19c2-create-directory-contact*/
filename respp&j. "%sysfunc(getoption(WORK))/Consentinfo&j..json";
PROC HTTP
METHOD="POST"
URL= "&url_./directories/&&DirectoryId&j./contacts"
OUT=respp&j.
in=dest&j.;
headers
'x-api-token'= &Api_Token.
'Content-Type'='application/json';
run;
libname respp&j. json "%sysfunc(getoption(WORK))/Consentinfo&j..json";
proc datasets lib=respp&j.;
run;
data TrasactionContactsImportSummary&j.;
set respp&j..alldata;
run;
data result&j.;
set respp&j..result;
call symputx("ContactId&j.",id,'g');
run;
%put "ContactId&j. = &&Contactid&j";
%end;
/* Number of Records per Minutes*/
%else
%do;
%put the pathname does not exist;
%end;
%end;
%end;
The sample json file look like that:
{"firstName" :"Clint1", "lastName" :"Eastwood1", "email" :"Clint1.Eastwood1@hotmail.com", "extRef" :"AAAAA1", "embeddedData" : { "Brand" :" Insurance", "Consent Date" :"15JUL2020:14:29:52", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }, { "firstName" :"Clint2", "lastName" :"Eastwood2", "email" :"Clint2.Eastwood2@hotmail.com", "extRef" :"AAAAA2", "embeddedData" : { "Brand" :" Insurance", "Consent Date" :"29AUG2022:08:25:57", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }, { "firstName" :"Clint3", "lastName" :"Eastwood3", "email" :"Clint3.Eastwood3@hotmail.com", "extRef" :"AAAAA3", "embeddedData" : { "Brand" :" Insurance", "Consent Date" :"29JUL2020:16:21:59", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }, { "firstName" :"Clint4", "lastName" :"Eastwood4", "email" :"Clint4.Eastwood4@hotmail.com", "extRef" :"AAAAA4", "embeddedData" : { "Brand" :" Insurance", "Consent Date" :"07NOV2019:04:24:10", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }, { "firstName" :"Clint5", "lastName" :"Eastwood5", "email" :"Clint5.Eastwood5@hotmail.com", "extRef" :"AAAAA5", "embeddedData" : { "Brand" :" Insurance", "Consent Date" :"14JUL2020:18:35:37", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }, { "firstName" :"Clint6", "lastName" :"Eastwood6", "email" :"Clint6.Eastwood6@hotmail.com", "extRef" :"AAAAA6", "embeddedData" : { "Brand" :" Insurance", "Consent Date" :"26JAN2022:17:13:50", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }, { "firstName" :"Clint7", "lastName" :"Eastwood7", "email" :"Clint7.Eastwood7@hotmail.com", "extRef" :"AAAAA7", "embeddedData" : { "Brand" :" Insurance", "Consent Date" :"13AUG2021:06:53:31", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }, { "firstName" :"Clint8", "lastName" :"Eastwood8", "email" :"Clint8.Eastwood8@hotmail.com", "extRef" :"AAAAA8", "embeddedData" : { "Brand" :" Insurance", "Consent Date" :"03FEB2021:14:02:29", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }, { "firstName" :"Clint9", "lastName" :"Eastwood9", "email" :"Clint9.Eastwood9@hotmail.com", "extRef" :"AAAAA9", "embeddedData" : { "Brand" :" Insurance", "Consent Date" :"24MAR2022:20:19:40", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }, { "firstName" :"Clint10", "lastName" :"Eastwood10", "email" :"Clint10.Eastwood10@hotmail.com", "extRef" :"AAAA10", "embeddedData" : { "Brand" :" Insurance", "Consent Date" :"14SEP2022:14:58:17", "Dataset Creation Timestamp" :"28MAR2023:22:01:07.758540" }, "unsubscribed" :"true" }
So, the issue I am facing here, it is like the API Web site is able to read only one record at the time and that per call. So when a json file containing 10 records is sent, it take only the first records and forgot the others.
I have sent the ten records each individually, it works but I will need to make ten different json files.
Is there a way to loop trough each record and make a call for each record.
... View more