Use rest api call to create a new jenkins slave using python Use rest api call to create a new jenkins slave using python jenkins jenkins

Use rest api call to create a new jenkins slave using python


After spending several hours, I found what we both missed:

-d "json=${JSON_OBJECT}"

Which means it's posting a string, so in python you need:

requests.post(url, data=f'json={json.dumps(postdata)}', headers=headers)