Showing results for 
Search instead for 
Did you mean: 

alteryx server Discussions

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

Access Gallery API through Alteryx APP


Hello Kevin


Thanks again for your help and the macro.


Apologies, I jumped the gun a bit, and rather than testing your macro as is (which I will do hopefully tomorrow), I worked on it to post instead to the /v1/workflows/{appId}/jobs/ endpoint to. run my test workflow (so I provided the appId instead of a jobId).


This was as I read here ( - in the response from NeilR) that one should "POST to the "/v1/workflows/{appId}/jobs/" endpoint to execute a workflow".

I also changed the macro to do this partly as I do not know where to find the jobId of my test workflow. Do apps get given jobIds only when they are scheduled?


I did see from the same forum post that "

Once a job has been executed and finished, you can use the "/v1/jobs/{jobId}/output/{outputId}/" endpoint to download the results. You can specify what format you want the results in"


So, from my understanding, I need to:

1.execute the app ("POST to the "/v1/workflows/{appId}/jobs/" endpoint)

2. then send a GET request to the /v1/jobs/{jobId}/output/{outputId}/" endpoint to get the results


Would I be correct here?

It would be great to find out about jobIds - if one can just execute an app with this one call, or if the app has to be scheduled in order for it to get a jobId?


You mentioned the Query parameter questions key value pairs:

I created a user interface to take in the query question key=value pairs inputted like so:



The macro then formats them to JSON and concatenates them to a string [Concat_Query_param_json_key_value]:



- and they are inserted into the Download tool Payload "use query string for body" section, into a skeleton JSON segment:

  "questions": ['+
 +' ]


I think I read that there's an Alteryx tool that allows viewing post/get requests, I will look into it. It will help with debugging.



By the way, the changed macro post request to execute my app gives me the a code 500 response:  "{"data":null,"exceptionName":"UnknownException","innerExceptionMessage":"","message":"Unknown error.\u000aInvalidOperationException\u000aRequestID: e612411806c64865a5e4a83989dcb1d8"}". Not massively helpful! I'll keep at it, though.


Thanks again for your help, much appreciated :)










After more testing:


As I now understand it, I need to make 3 requests to execute an app job and to get the result:

execute the app (POST),

GET the jobId,

GET the OutputId?


1: execute an app by sending its appId  - a POST request to the/v1/workflows/{appId}/jobs/ endpoint

where I get the jobId of the job that just ran

  "id": "589d8ae79cb9b02961ce4186",
  "createDate": "2017-02-10T09:41:59.1417615Z",
  "status": "Queued",
  "disposition": "None",
  "outputs": [],
  "messages": []


2: do a GET request using the retrieved jobId to /vi/jobs/{jobId} endpoint to get the outputId from the the job that just ran (where  I get the max createddatetime so I get the latest outputId?):

outputs": [
      "id": "589d8ae79cb9b02961ce4189


3: do a GET request to the  /v1/jobs/{jobId}/output/{outputId} endpoint - sending the retrieved jobId and outputId to get the output result, e.g:



The above was done using the Gallery interactive documentation.


The Alteryx macro and workflow I am working on to do this just now does stage 1 (POST to execute a job) - but I am getting a a code 500 internal server error.

Not sure if this could be caused by the format of the Query parameters in my POST request:

I put them in the in the download tool payload - "Use Following for Querystring/Body" section:

  "questions": [ '+
 +' ]

The [Concat_Query_param_json_key_value]  variable value looks like so:





For the macro/app I am working I am thinking that I then need to use the resulting jobId, do a GET request for the outputId, and then do another GET request for the result.


I also will look into the Alteryx Server logs to see if I can find anything relating to the 500 error there.


Thanks to @Kanderson and @patrick_digan for your help so far.






Ok, my error:


My test app (that I am calling up on our Alteryx Gallery) had output to a Generic Tool as well as to a file.

The Generic Tool is needed for handling outputs when using the Alteryx Engine API.


I took the Generic Tool out and it is working fine, I get a response with the jobId.


Right, now to save a version of my caller app, and onwards and upwards!



Quite a few steps forward, but one big step back...

@Kanderson - you wrote offering help with how to add in the query parameters to the post request, it would be great with a bit of help on this.

My test workflow works fine to send a post request to execute a test app that takes no query parameters - great, I get the jobId back and have developed the flow to then GET the outputId, then GET the output ok.

The problem is when I execute the test app that takes in the 2 query params. I get a 500 internal server error.
Executing this test app taking in the 2 query params via the Gallery Interactive Documentation works fine, so I am thinking that it must be some issue in my workflow, how the query params are formatted/being added.

The test app takes 2 query params, so I have built a string var like this:

{"questions": [{"name":"uiname","value":"mike"},{"name":"uinumber","value":"7"}]}

In my workflow that makes the post request I have tried adding this JSON string into the Download- Payload "Take Query String/Body from Field", with no luck.

I've also tried adding just the JSON array of query key,values [QueryParamsJSONArray] = '{"name":"uiname","value":"mike"},{"name":"uinumber","value":"7"}' into a question skeleton JSON statement, like this:


but again, no luck, I get the 500 error response.

Maybe I am missing some stage with formatting the query params - do they need to be percent-encoded?

I have not included them in with the QAuth params that make up the Signature base string, nor in the URL.

Any ideas/help would be much appreciated :)


I got it to work. The problem was caused by the wrong content-Type in the post request, so I set it in the Download tool header to "application/json", and all works fine now.



Alteryx Certified Partner
Thats great! Nice work!


Kevin Anderson | Data Scientist


New England's Data Resource


twitter: @ArkaKevinA

I am getting same error.  What is the best way to get this to be in same timezone as the server?


{"data":null,"exceptionName":"UnauthorizedException","innerExceptionMessage":"","message":"Timestamp is not close enough to the current server time."}


Current Formula:

ToString(DATETIMEDIFF(DateTimeAdd ([DateTime_Out],-5,"hours") , '1970-01-01 00:00:00', 'seconds'))


Old Formula:

ToString(DATETIMEDIFF([DateTime_Out], '1970-01-01 00:00:00', 'seconds'))


Created the following that works.

ToString(DATETIMEDIFF(DateTimeAdd ([DateTime_Out],DateTimeDiff(DateTimeToUTC([DateTime_Out]),[DateTime_Out],"hours"),"hours") , '1970-01-01 00:00:00', 'seconds'))



I followed the same approach to resolve the time difference error. Was able to solve it, but now I have a authentication error. Been trying to figure out how to fix this, but no luck so far. The macro did not worked for me so far, this simply creates the request URL, but returns only errors after passing it to the download tool to GET. Tried to POST as well.


Any thoughts on what I might be missing? 


Error -

{"data":null,"exceptionName":"UnauthorizedException","innerExceptionMessage":"","message":"The provided signature(oauth_signature) is invalid."}