Environment API¶
Environments do not behave in quite the same way in the API as they do in the Web UI. In the API, create Categories and their child Elements first, then create a Profile for which you can create Environments whose elements must each belong to a separate profile.
Profile¶
- GET /api/v1/profile¶
Category¶
- GET /api/v1/category¶
Element¶
- GET /api/v1/element/¶
Environment¶
- GET /api/v1/environment¶
Filtering¶
elements: (optional) The Element ID to filter on. Example request:
GET /api/v1/environment/?format=json&elements=5
- GET /api/v1/environment/<id>¶
- POST /api/v1/environment¶
Required Fields¶
profile: A resource uri to the parent Profile. elements: A list of element resource uri’s.
Note
Each element must be from a separate category.
- DELETE /api/v1/environment/<id>¶
- PUT /api/v1/environment/<id>¶
- PATCH /api/v1/environment¶
The PATCH command is being overloaded to provide combinatorics services to create environments out of elements contained by categories.
To create environments for all of the combinations of elements in the listed categories:
data={ u'profile': u'/api/v1/profile/1', u'categories': [u'/api/v1/category/1', ...] }
You may also do combinatorics with partial sets of elements from the categories by using dictionaries with ‘include’ and ‘exclude’ keys.
data={ u'profile': u'/api/v1/profile/1', u'categories': [ { u'category': u'/api/v1/category/1', u'exclude': [u'/api/v1/element/1'] }, { u'category': u'/api/v1/category/2', u'include': [ u'/api/v1/element/4', u'/api/v1/element/5' ] }, { u'category': u'/api/v1/category/3' } ] }
Note
The included or excluded elements must be members of the category they accompany. If both include and exclude are sent with the same category, exclude will be performed.