Product SiteDocumentation Site

8.3.2.  Creating a Resource

A new resource is created with a POST request to collection URI containing a representation of the new resource.
Each resource type has its own specific required properties. The client supplies these properties when creating a new resource. Refer to the indiviual resource type documentation for more details. If a required property is absent, the creation will fail with a fault representation indicating the missing elements.
POST /rhevm-api/{collection} HTTP/1.1
Accept: application/xml
Content-Type: application/xml

<{resource}>
    <name>Resource-Name</name>
</{resource}>

HTTP/1.1 201 Created
Location: http://{host}/rhevm-api/{collection}/{resource_id}
Content-Type: application/xml

<{resource} id="{resource_id}" href="/rhevm-api/{collection}/{resource_id}">
    <name>Resource-Name</name>
    ...
</{resource}>
The Location header in the response gives the URI of the queried resource. The response body contains either a complete representation, partial representation or no representation of the resource. It is recommended that clients rely only on fetching the representation via the URI in the response header.