Inspire EMEA 2022 On-Demand is live! Watch now, and be sure to save the date for Inspire 2023 in Las Vegas next May.

Alteryx Server Discussions

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

API to run the workflow

RajithaGanji
6 - Meteoroid

Can we trigger the Run button of an Alteryx workflow from our application / website? If so what is the API that is used to trigger the workflow?

 

I have found only API's which give me the output related to the workflows which have been already executed, te API's that I found are from https://gallery.alteryx.com/api-docs

 

But I want to freshly execute the workflow externally using an API, Like we click the run button and the workflow gets executed inside Alteryx Gallery, same way it has to be executed from website using an API. What is the API to Run Alteryx workflow?

 

This is the API. This API is giving me the Job Id's which are already executed. There are no new workflows getting executing with this API.

 

<mywebsite.com>/gallery/api/v1/workflows/<appid>/jobs/?oauth_consumer_key=<consumer_key>&oauth_signature_method=HMAC-SHA1&oauth_nonce=979286045&oauth_timestamp=1641709486&oauth_version=1.0&oauth_signature=<oauth_signature>

 

Also, I am adding the image of API for better understanding. Please see the attachment for image

 

 

10 REPLIES 10
AkimasaKajitani
16 - Nebula
16 - Nebula

Hi @RajithaGanji 

 

The API to execute the Workflow is as follows.

POST /v1/workflows/{appId}/jobs/


After the calling that API, you need to poll the status of the workflow using the API bellow.

 

GET /v1/jobs/{jobId}/


When the workflow finishes, you can get the result using the API bellow.

 

GET /v1/jobs/{jobId}/output/{outputId}/
RajithaGanji
6 - Meteoroid

Hi @AkimasaKajitani,

 

I have tried the API 

/v1/workflows/{appId}/jobs/

 

<mywebsite.com>/gallery/api/v1/workflows/<appid>/jobs/?oauth_consumer_key=<consumer_key>&oauth_signature_method=HMAC-SHA1&oauth_nonce=979286045&oauth_timestamp=1641709486&oauth_version=1.0&oauth_signature=<oauth_signature>

 

This is my API call which I am triggering from the sample javascript code given in the API Documentation. I have also added the image of API for more understanding (Please see the attachment below). This API call is not newly executing workflow, but it is giving me the job id's which are already executed. I don't see any new jobs under my jobs in the gallery.

 

Is the API correct?

RajithaGanji
6 - Meteoroid

Hi @AkimasaKajitani,

 

I have tried the sample javascript code given in API documentation in Alteryx Gallery. I have tried the below API. This API is giving me the Job Id's which are already executed as response. There are no new workflows getting executing with this API.

 

<mywebsite.com>/gallery/api/v1/workflows/<appid>/jobs/?oauth_consumer_key=<consumer_key>&oauth_signature_method=HMAC-SHA1&oauth_nonce=979286045&oauth_timestamp=1641709486&oauth_version=1.0&oauth_signature=<oauth_signature>

 

Also, I am adding the image of API for better understanding. Please see the attachment for image.

 

 

Is the API correct? Why is it giving me the workflows which are already executed and not running the workflow newly?

 

AkimasaKajitani
16 - Nebula
16 - Nebula

Hi @RajithaGanji 

 

Thank you for the detail explanation. I see. I had misunderstood.

 

I think that you may need to use User V2 API that can be resolved the credential problem.

It was released at Server 2020.2.

 

Please refer the URL bellow.

https://community.alteryx.com/t5/Alteryx-Server-Discussions/API-POST-request-to-queue-a-job-not-work...

 

 

 

 

 

RajithaGanji
6 - Meteoroid

@AkimasaKajitani

 

I have tried using User V2 API  <mywebsite.com>/gallery/api/user/v2/workflows/<appid>/jobs/?oauth_consumer_key=<consumer_key>&oauth_signature_method=HMAC-SHA1&oauth_nonce=979286045&oauth_timestamp=1641709486&oauth_version=1.0&oauth_signature=<oauth_signature>

 

It is still returning the jobs of already executed workflows. And in the link you mentioned I didn't understand what the solution is to my question. Do I need to create any credentials?

AkimasaKajitani
16 - Nebula
16 - Nebula

Hi @RajithaGanji 

 

Honestly, I don't know the reason why it don't work. In this case, we should confirm the details.

 

Did you try to use the Interactive documentation?

https://{yourhostname}/api-docs/

You can input API Key and Shared Secret and appID and values, it work on the document and you can confirm the behavior.

 

And your workflow to run from external is simple workflow that don't need the input file or etc?

 

 

 

 

patrick_digan
17 - Castor
17 - Castor

@RajithaGanji Are you doing a POST or GET request? You'll want to POST, but the data you're receiving (old jobs) sounds more like a GET request. That v1 endpoint can accept both POST and GET requests and it returns different things.

RajithaGanji
6 - Meteoroid

Hi @AkimasaKajitani,

 

The API was working. I was checking the Alteryx Gallery, later I came to know that the workflows which are run through API will not be shown in Alteryx Gallery UI, but I was getting the response in the API.

 

Thanks for your answer.

 

Also, how can I implement the Javascript functions in my node js application? Is there a sample code for using in NodeJS. 

Because in my case the workflow has to be executed from NodeJS. Whereas, when I tried to implement the same functions I noticed there are all Javascript and Jquery functions in the sample code given in API Documentation.

 

I have started this question as a new topic here https://community.alteryx.com/t5/Alteryx-Server-Discussions/How-to-Run-Alteryx-Workflow-from-NodeJS...

 

If you are aware please help !!

 

ananthtony
6 - Meteoroid

The POST user V2 API is "/user/v2/workflows/{appId}/jobs/" is used to execute a workflow. But this is not working for the workflows which are shared by other users. For example, we have a collection with multiple jobs developed by multiple developers and we are trying to use a batch/admin user to execute the jobs Via Gallery API. We are getting "access denied" error for those workflows. Please advise.