Change host's puppet enviroment via API

Hello everyone,

I am trying to update the value of puppet environment of some nodes with a script.

In the past I remember querying the environment endpoint of the Foreman API, getting the id of the environment, and then upgrading the host with the new puppet_envriroment id.

But this does not seem to work anymore (seems the Environment endpoint was deleted from the API)

What is the recommended way of doing it now?
Ah also, I am running Foreman 3.3.0.


Ah found it :slight_smile:

List all environments /foreman_puppet/api/environments
Show an environment /foreman_puppet/api/environments/:id
Create an environment /foreman_puppet/api/environments
Update an environment /foreman_puppet/api/environments/:id
Delete an environment /foreman_puppet/api/environments/:id

You can access the list of endpoints via: https://your-foreman.server/api/v2/