We are using rest api to load alerts into VI dynamically.
The SAS code is running fine when it is ran from SAS Studio. But when the same code is put in job execution source code, alert does not get generated.
We are passing macros :alert_id,score, emp_name
Code:
%global x;
%macro zxc;
data x;
format a $1000.;
format b $10000.;
format c $10000.;
format d $10000.;
format dcat2 $10000.;
alert_id="&alert_id";
entity_id="&emp_name";
queue_id='queue_default';
score1=&score;
a='{"alertingEvents":[{"alertingEventId":';
b=trim(quote(trim(alert_id)));
c=catt(a,b,',"actionableEntityType":"employee1","scoreAggregationPolicy":"SUM"');
d=catt(c,',"actionableEntityId":',trim(quote(trim(entity_id))),',"alertOriginCd": "CUSTOM","alertTypeCd": "CUSTOM","alertTriggerTxt": "Excessive Opioid Prescriptions","recQueueId": ',trim(quote(trim(queue_id))),',"score": ',trim(quote(trim(score1))),"} ]}'");
dcat2 = catt("'",d);
run;
proc sql;
select dcat2 into:x from x;quit;
%sysexec curl -X POST -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsImprdSI6Imh0dHBzOi8vbG9jYWxob3N0L1NBU0xvZ29uL3Rva2VuX2tleXMiLCJraWQiOiJsZWdhY3ktdG9rZW4ta2V5IiwidHlwIjoiSldUIn0.eyJqdGkiOiI3ZGY1NTNmOWJmMzE0MWNiYTkxNGU0YWY1ZmQ4ZGYwMiIsImV4dF9pZCI6InVpZD1zYXNkZW1vLG91PXVzZXJzLGRjPXZpeWFkZW1vLGRjPWNvbSIsInN1YiI6IjE3M2I3N2E5LTk5MjMtNDQ2Ny1iMzE0LTY4NmQ3NWMxYzQ3NiIsInNjb3BlIjpbInN2aXVzcnMiLCJzdmlhZG1zIiwiY2xpZW50cy5yZWFkIiwiY2xpZW50cy5zZWNyZXQiLCJ1YWEucmVzb3VyY2UiLCJzYXMiLCJvcGVuaWQiLCJ1YWEuYWRtaW4iLCJjbGllbnRzLmFkbWluIiwic2NpbS5yZWFkIiwiZ3JvdXAxIiwidnNkZG5ncyIsIlNBU0FkbWluaXN0cmF0b3JzIiwiY2xpZW50cy53cml0ZSIsInNjaW0ud3JpdGUiXSwiY2xpZW50X2lkIjoic2FzLmVjIiwiY2lkIjoic2FzLmVjIiwiYXpwIjoic2FzLmVjIiwiZ3JhbnRfdHlwZSI6InBhc3N3b3JkIiwidXNlcl9pZCI6IjE3M2I3N2E5LTk5MjMtNDQ2Ny1iMzE0LTY4NmQ3NWMxYzQ3NiIsIm9yaWdpbiI6ImxkYXAiLCJ1c2VyX25hbWUiOiJzYXNkZW1vIiwiZW1haWwiOiJzYXNkZW1vQG5vbmUuc2FzLmNvbSIsImF1dGhfdGltZSI6MTU5MTcyNTk0OSwicmV2X3NpZyI6ImRjNzA2NzE3IiwiaWF0IjoxNTkxNzI1OTQ5LCJleHAiOjE1OTE3NjE5NDksImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3QvU0FTTG9nb24vb2F1dGgvdG9rZW4iLCJ6aWQiOiJ1YWEiLCJhdWQiOlsic2NpbSIsImNsaWVudHMiLCJzYXMuKiIsInVhYSIsIm9wZW5pZCIsInNhcy5lYyJdfQ.oxLGptK8G-y1LGxqdNdfe56WjUpeSvn3HHeUUL9xqQAq6pahSmoBj-ShfW5VD0ivF5Q95LcOhfAlgCj7IlehnkWWe2iBB2trVRYn6aN7LlF8d5ekZHNuyELmgnLZG8o16F9-NR_0YWaV8KhC36lDxnJJRyXxnjjMS6pYcqtUv87TnsML0fVujQbYsmKJSmFiT-GPblTwa6DJZEFUfRNF1_oaRfxMyhkvCM3u4AyvcTtj-1GfAz6FDG_zhs9VwFJXztM8YDQUKSbN9Wvhx2inoUCXzBNcN0Ota-kRLZik-riH6xc9iL2tPD_FhD2oTbMNNGf65oR7va7gAkgv8CoxTw" -H "Accept: application/vnd.sas.collection+json" -H "Content-Type: application/vnd.sas.fcs.tdc.alertingeventsdataflat+json" -d &x "http://sasserver.demo.sas.com/svi-alert/alertingEvents";
%mend zxc;
%zxc;