Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.

Access denied error when running API call to execute a workflow that I don't own

kshyntassov
5 - Atom

Hi,

 

I wrote a powershell script to execute a workflow that I don't own via API call (Invoke-RestMethod).

 

 

$run_response = Invoke-RestMethod -Uri $run_url -Method Post -Headers $headers -body $json_payload -ContentType 'application/json'

 

 

However, I get the following error:

 

 

Invoke-RestMethod : {
  "message": "Access denied."
}
+ ... _response = Invoke-RestMethod -Uri $run_url -Method Post -Headers $he ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

 

I tried running my script on workflows that I own and it works fine. I also tried using the owner's credentials and it works fine too. However, when I use my credentials to run a workflow that I didn't create, I get an access denied error. I tried running powershell as administrator and my role is set to 'Curator'. I use Tls12 security protocol in my script.

 

Anyone encountered this issue?

 

Thanks

 

1 REPLY 1
albert_alaluf
10 - Fireball
10 - Fireball

Hi @kshyntassov 

 

Try to add your username/password in Alteryx Gallery Credentials. We had a similar case. My coworker was trying to run a workflow that was being created by someone. It was OK, because his name was added to the same collection, and he had access. However, when he was trying to call via API, he was getting the same error. We investigated the issue, and found that when the user scheduled the workflow on the server with his credentials, the workflow job was showing the workflow ran as his id. But when he was trying to run within API, it was showing the Alteryx Gallery Server account id. To fix this, we added his credentials to the server and when he ran it, we saw that the job ran as his credentials. I believe your issue is similar as us, it may work for you.

Albert Alaluf
Alteryx ACE
https://www.linkedin.com/in/alaluf/