You can pass a single JSON object to create a single element, or a JSON array of event JSON objects to create multiple elements. If you create a single element, the response includes the URI of the new element in the Location response header, and the response body includes one event JSON object with the format specified by the format parameter. If you create multiple elements, the response includes a JSON array of event JSON objects with the specified format in an order that corresponds to the order of the input data. If no format is specified, the "detail" format will be used by default. If creating a large number of elements in a single request, it is recommended to use the "list" or "name" formats for better performance, when the use case allows it.
Request
POST http://{hostname}:{port}
/events/?{parameters}
Accept: application/json
Content-Type: application/json
Table 1. Request parametersParameter |
Type |
Required |
Description |
format |
string |
false |
One of the format options; this parameter determines what information is included in the JSON response. If not specified, or if an unrecognized value is specified, the default format of "detail" will be used. |
For the
format parameter, use one of the following format options:
- list
- Primary properties with type and releases
- detail
- Identical to 'list' format
For details about the full JSON that the server returns when you select one of these formats, see the related resource:
event resource.
Example
curl -k -u jsmith:passwd
"http://myserver.example.com:8080/events/"
-X POST
-H "Accept: application/json"
-H "Content-Type: application/json"
-d @newEvent.json
Example JSON request
{
"name": "Example event",
"description": "Optional description",
"startDate": 1413384452,
"endDate": 1413394452,
"type": {
"id": "00000000-0000-1100-0000-000000000011"
}
}
Example JSON response
{
"type": {
"color": "#808080",
"order": 0,
"name": "Blackout",
"description": "No production deployments during this blackout period",
"ghostedDate": 0,
"id": "00000000-0000-1100-0000-000000000011",
"version": 0,
"dateCreated": 0
},
"startDate": 1413384452,
"endDate": 1413394452,
"isOneDay": false,
"releases": [],
"description": "Optional description",
"name": "Example event",
"id": "4f47d1fe-f25a-4f9e-a91a-c8fb0668e99a",
"version": 0,
"dateCreated": 1421692929323
}