forked from kurrent-io/KurrentDB
-
Notifications
You must be signed in to change notification settings - Fork 0
HTTP EventType Header
Dan Leech edited this page Dec 16, 2014
·
5 revisions
This wiki is no longer maintained and should not be used. Read the Event Store docs at docs.geteventstore.com.
The latest version of the page you are currently viewing is available here.
Note that this event is only available in version 3.0 or higher of the event store
When writing to a stream and not using the application/vnd.eventstore.events+json/+xml media type it is necesary that you specify an event type with the event that you are posting. This is not required with the custom media type as it is also specified within the format itself.
You can use the ES-EventType header as follows.
ouro@ouroboros$ curl -i -d @/home/ouro/myevent.json "http://127.0.0.1:2113/streams/newstream" -H "Content-Type:application/json" -H "ES-EventType: SomeEvent" -H "ES-EventId: C322E299-CB73-4B47-97C5-5054F920746E"HTTP/1.1 201 Created
Access-Control-Allow-Methods: POST, DELETE, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type, X-Requested-With, X-PINGOTHER, Authorization, ES-LongPoll
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location, ES-Position
Location: http://127.0.0.1:2113/streams/newstream/1
Content-Type: text/plain; charset=utf-8
Server: Mono-HTTPAPI/1.0
Date: Mon, 21 Apr 2014 21:26:48 GMT
Content-Length: 0
Keep-Alive: timeout=15,max=100If you now view the event in the UI or through curl it will have the EventType of SomeEvent associated with it.
ouro@ouroboros:$ curl http://127.0.0.1:2113/streams/newstream/1HTTP/1.1 200 OK
Access-Control-Allow-Methods: GET, OPTIONS
Access-Control-Allow-Headers: Content-Type, X-Requested-With, X-PINGOTHER, Authorization, ES-LongPoll
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location, ES-Position
Cache-Control: max-age=31536000, public
Vary: Accept
Content-Type: application/vnd.eventstore.atom+json; charset=utf-8
Server: Mono-HTTPAPI/1.0
Date: Mon, 21 Apr 2014 21:29:27 GMT
Content-Length: 585
Keep-Alive: timeout=15,max=100
{
"title": "1@newstream",
"id": "http://127.0.0.1:2113/streams/newstream/1",
"updated": "2014-04-21T18:26:48.731192Z",
"author": {
"name": "EventStore"
},
"summary": "SomeEvent",
"content": {
"eventStreamId": "newstream",
"eventNumber": 1,
"eventType": "SomeEvent",
"data": {
"something": "has data"
},
"metadata": ""
},
"links": [
{
"uri": "http://127.0.0.1:2113/streams/newstream/1",
"relation": "edit"
},
{
"uri": "http://127.0.0.1:2113/streams/newstream/1",
"relation": "alternate"
}
]
}