theforeman/foreman — pull request #403 by isratrade (2013-02-07 10:09:51+00:00)
Title: APIv2 for locations and organizations

1) CRUD actions for locations and organizations
api/locations
api/locations/:id - Show action shows nested *_ids
api/organizations
api/organizations/:id

2) GET Nested locations and organizations for domains, subnets, environments, ...
api/locations/:id/organizations
api/organizations/:id/locations
api/domains/:id/locations
api/subnets/:id/organizations

3) GET Nested domains, subnets, etc for locations OR organizations OR BOTH
api/locations/:id/domains
api/organizations/:id/domains
api/organizations/:id/locations/:id/domains
api/locations/:id/organizations/:id/domains

4) UPDATE/PUT Nested attributes including *_ids as part of RESTful updates on location/organization OR on domains, subnets, etc.. and updating location_ids or organization_ids

ppcurl -u admin:secret -H "Content-Type:application/json" -H "Accept:application/json,version=2" -X PUT -d "{\"location\":{\"domain_ids\":[1,6,11]}}" http://0.0.0.0:3000/api/locations/76

ppcurl -u admin:secret -H "Content-Type:application/json" -H "Accept:application/json,version=2" -X PUT -d "{\"domain\":{\"location_ids\":[76,86]}}" http://0.0.0.0:3000/api/domains/1

TODO - API documentation for locations and organizations controller. Waiting on fix to apipie gem