API extra_vars/ Environment not working correctly? #2480
Replies: 1 comment
-
Update: I have tried several iterations to make sure the syntax is correct, and still cannot get this to work. I have upgraded semaphore to the latest build, and that did not resolve the issue. I am using https://codebeautify.org/jsonviewer to verify my json is correct, and have removed the whitespace to simplify, and that did not work. The previously aforementioned syntax in post #2246 according to codebeautify.org has extra double quotes around the nested property curly braces and is not valid, probably why I could not get it to work. I have tried both
and
and neither of them work., still the 400 Bad Request error. At this point, I believe there is some type of bug. |
Beta Was this translation helpful? Give feedback.
-
I am having a problem with the API or perhaps a syntax. I saw the post here #2246
and modified this curl syntax for my environment. Using this as a guideline, I am able to kick off my template 17 on the ubuntu 24.04 server itself, which has no extra_vars and is just a simple ansible winping at it runs successfully, proving that my token, username/password, and syntax is correct. However, I have a copy of this template, which is template 24, which prompts for the server to winping, and when run from the web interface and filled out correctly with a server to run against, works fine. However, when run from the API, I cannot get it to work, it's always a 400 Bad request. This is the curl statement I am using:
curl -v -XPOST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer TOKEN=' -d '{
"template_id": 24,
"environment": "{"winpingserver":"server.gotham.local"}"
}' http://ansibleserver.gotham.local:3000/api/project/1/tasks
I am using Semaphore 2.10.22 for now, will be upgrading soon.
Any ideas? Is this a bug or ID10T/ PEBKAC error on my part? Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions