How to assign puppet class to host via api?

Hello everyone, I’m trying to assign a puppet to the host class via the api, but I get an error.
Foreman version 3.6

curl -k -u user:pass -H "Accept: version=2,application/json" \

-H "Content-Type: application/json" -X POST \

-d '{ "puppetclass": { "id":130,"name":"git","module_name":"git" }' \

Tell me how to do it correctly ?

found a solution!!))

curl -k -u user:pass
-H “Content-Type: application/json” -X POST
-d “@payload.json


“puppetclass_ids”: [130]

1 Like