Hey Alteryx Community,
I'm developing a pipeline for some data that requires the use of the Alteryx Server / Gallery API using python. I've successfully gathered the authorization token from the API and can ping workflows sitting on my company's gallery; however, I'm struggling to pass a body through the questions in the analytic app interface.
I'm thinking I need to pass a more detailed JSON, but am unsure how to structure it. The workflow has a JSON parse tool and is designed to take the body from the interface. However; it fails to pass when I ping the API. Any ideas on troubleshooting?
My body looks like this:
Below is an image of what the interface looks like.
Hi @Brando ,
Firstly, I would recommend accessing Swagger; you can test and see the JSON structure to be sent.
Access the API V1 on the drop-down at the top and clicking on Explore
There you will have access to this endpoint here and on the right side you will see the Json structure to be followed.
{
"questions": [
{
"name": "string",
"value": "string"
}
],
"priority": "string"
}
You don`t need to include the priority. The name will be the tool name and the value is what is inside your Json Input box, as follows.
{
"questions": [
{
"name": "Text Box (2)",
"value": "testTwo"
}
]
}
Text Box (2) is coming from the tool`s annotation page.
If you are not entirely sure where to get the tool name, you also have this endpoint here that will return all the interface tools and their names from a Gallery workflow.
/v1/workflows/{appId}/questions
Best,
Fernando Vizcaino
@fmvizcaino Thanks for the detail, so I operated the questions endpoint and received the following:
[{'name': 'Text Box (5)', 'questionType': 'QuestionTextBox', 'description': 'JSON_Input', 'value': '', 'multiple': False, 'items': []}]
However, when I pass the following back into the body:
Hey @Brando ,
You only need to include the name and value as follows:
{
"questions": [
{
"name": "Text Box (5)",
"value": ""
}
]
}
But from the response, it looks like the workflow is on the Queue and will run.
Next, you can use the /v1/jobs/{id} to check the workflow status (running or completed). The jobID is the one you got in the response (664ce952d53b0000dc003637)
After completion, if you have outputs you want to download, you can use this endpoint here. /v1/jobs/{id}/output/{outputId}.
JobID: 664ce952d53b0000dc003637
OutputID: If any, you will get the ID from this /v1/jobs/{id}
Best,
Fernando Vizcaino