-
Notifications
You must be signed in to change notification settings - Fork 6
Create a resource (v2)
Used to create a resource in the FIM Service
Method | URL |
---|---|
POST | /v2/resources/ |
POST | /v2/resources/?return=minimal |
This request type requires a JSON-formatted list of attribute/value pairs to save with the resource. An ObjectType attribute is required in the body.
Parameter name | Description |
---|---|
{return} | Setting return=minimal will prevent the API from returning the newly created resource in the response body. This can also be set by the Perfer request header below. |
This API call also supports the advanced resource rendering options
By default, the API will return the full representation of the newly created object in the response body. The Prefer
header can be set with a value of return=minimal
to prevent the API from returning the newly created resource in the response body. This can save bandwidth when the details of the newly created object are not required.
This can also be set by a query parameter as shown above
If the resource was created successfully, the API will return a 201 - Created
response, with a Location
header indiciating the path to the resource
See the topic on error handling for the other response codes that this API call can return.
A URL to the resource will be returned in the Location
header
If successful, this method will return the newly created resource
The following example creates an object, and retrieves the full representation of the object in the response
POST /v2/resources/
{
"ObjectType": "Person",
"AccountName": "testuser",
"DisplayName": "Test User"
}
HTTP/1.1 200 OK
Location: http://localhost:63207/v2/resources/c3be8d94-0c07-429e-9105-f17d2c5b581e
{
"ObjectType": "Person",
"ObjectID": "c3be8d94-0c07-429e-9105-f17d2c5b581e",
"CreatedTime": "2016-09-12T03:28:33.380",
"Creator": "6437407e-eb9f-4eb9-9be5-d37bbf0be67a",
"AccountName": "testuser",
"DisplayName": "Test User"
}
The following example creates an object, and specifies that the server does not need to return the object in the response
POST /v2/resources/
Prefer: return=minimal
{
"ObjectType": "Person",
"AccountName": "testuser",
"DisplayName": "Test User"
}
HTTP/1.1 200 OK
Location: http://localhost:63207/v2/resources/c3be8d94-0c07-429e-9105-f17d2c5b581e