I created client id and password following the steps mentioned in the below blog https://blogs.sas.com/content/sgf/2023/02/07/authentication-to-sas-viya/ After generating the access token ran a sas api to run a job definition import http.client
conn = http.client.HTTPConnection("example.com")
payload = "{\n \"name\": \"proc print example\",\n \"description\": \"ods output with age 14 cutoff\",\n \"jobDefinitionUri\": \"/jobDefinitions/definitions/2cbe5f60-1391-42db-a857-271e83eb7e48\",\n \"arguments\": {\n \"AGE\": \"14\"\n }\n}"
headers = {
'Delegate-Domain': "",
'Content-Type': "application/json",
'Authorization': "Bearer <access-token-goes-here>",
'Accept': "application/json, application/vnd.sas.job.execution.job+json, application/vnd.sas.error+json"
}
conn.request("POST", "/jobExecution/jobs", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8")) The output i recieved is {
"version": 2,
"httpstatusCode": 500,
"errorCode": 30081,
"message": "Invalid user: \"clientid\"",
"details": [
"traceId: cf313c5d4b62431f",
"path: /launcher/processes",
"path: /compute/contexts/8c3023b8-9fe1-4b4b-ba67-7ced166e9b49/sessions",
"correlator: 531e7c41-d3d9-48ed-86e6-bdce959e48d7"
]
} Details of the job definition proc print data=sashelp.iris (obs=&n_rows);
title "First &n_rows Rows of the Iris Dataset";
run; When i create access token using sas user id and password, the job request executes successfully. But the request gets failed while using auth token of client id. What necessary Authorization should be given to client id to run a job in compute.
... View more