Problem:
I want to next a location under an existing one via the API.
I tried the following JSON:
{
"location[name]": "Test+API",
"location[parent_id]": "7"
}
I also tried the following:
{
"location[name]": "Test API",
"location[parent_id]": "7"
}
{
"location_id": "12",
"location[parent_id]": "7"
}
{
"location_id": 12,
"location[parent_id]": "7"
}
{
"location_id": 12,
"location[parent_id]": 7
}
{
"location_id": 12,
"location[parent_id]": 7
}
with location_id instead of the location[name], with the id of the parent without quotes etc.
It doesn’t work!
I checked in my Satellite Server from Firefox what is the API request and it looks like it’s like the one I posted above. From Satellite (of course) it works, when I run this with curl it doesn’t.
The curl is called like this:
curl --header "Content-Type:application/json" --request PUT --user admin:password --data @edit_location.json https://foreman.example.com/api/locations/12
Expected outcome:
API call should next my location under the location with ID 7.
What do I miss?