[AWX] [Rest API] workflow_job_template_nodes endpoint does not support POST request

Hi,

I have an issue with AWX Rest API:

I want to create a new workflow job template node with the REST API. I’ve tried two endpoints:

POST on /api/v2/workflow_job_template_nodes with {“workflow_job_template”: 4242, “unified_job_template”: 1337} in body

POST on /api/v2/workflow_job_templates/4242/workflow_nodes with {“unified_job_template”: 1337} in body

Headers were {“Authorization”: “Bearer SECRET”} (Token with Write scope on the right application)

In both cases I got a 200 response with same result as GET request in body. No node was created.

My AWX version is 23.1.0

How to reproduce:

Send POST request to /api/v2/workflow_job_template_nodes with {“workflow_job_template”: 4242, “unified_job_template”: 1337} in body

OR

POST on /api/v2/workflow_job_templates/4242/workflow_nodes with {“unified_job_template”: 1337} in body

workflow_job_template 4242 and job_template 1337 are assumed to exist

Related GitHub Issue with further informations: [Rest API] workflow_job_template_nodes endpoint does not support POST request · Issue #14599 · ansible/awx · GitHub

Thanks by advance for any help

Hello @tom_capelle,
Welcome to the Forum!

We would like to get a bit more information from you. Are you able to make any posts via the API?

Thank you for your time!

Hi @djyasin ,

Thank you for your answer.

Yes I am able to do post requests on other endpoints, such as " [/api/v2/job_templates/]" for example. When I do it, I get a 201 answer and the associated ressource is created. (Or I get a 400 answer if I did something wrong)

What bothers me here is that any request I make with the API to create a workflow_node seems to be treated as a “get” request, I am not even able to get an error message which indicates me that I am doing something badly.

Curiously, I am able to create a workflow_node through the UI, and it works just fine even if I can’t see any 201 answer in my web console (see the screenshots posted on the github issue, I can duplicate them here if needed)

Thank you for your time aswell.

I´ve just tried to reproduce your issue with one of our AWX instances, but for me it works. (version 23.3.1)

What I´ve done:
Go to an already present workflow job template via Browser: /api/v2/workflow_job_templates/401/workflow_nodes/

Send a POST request to that endpoint with data as suggested by the Browser API:

{
    "extra_data": {},
    "inventory": null,
    "scm_branch": "",
    "job_type": null,
    "job_tags": "",
    "skip_tags": "",
    "limit": "",
    "diff_mode": true,
    "verbosity": null,
    "execution_environment": null,
    "forks": null,
    "job_slice_count": null,
    "timeout": null,
    "unified_job_template": 12345,
    "all_parents_must_converge": false,
    "identifier": "another_node"
}

The browser shows a “201 Created” and the expected result is visible within AWX.

Maybe check, if you supply all required fields to the endpoint. See respective info in the awx.awx collection documentation (for the mentioned endpoint, I guess only identifier and probably unified_job_template are required).

After some deeper investigation, we found out that our AWX instance receives GET requests on some endpoints even if we send POST requests, it seems to come from the ingress controller which redirects wrongly our requests, it is not an issue on AWX end.

Sorry for the inconvenience and thank you for the time you spent on my issue.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.