Why is content type int32 and not string?

The definition of a new event in ClientMessageDtos.proto is as follows:

message NewEvent {
required bytes event_id = 1;
required string event_type = 2;
required int32 data_content_type = 3;
required int32 metadata_content_type = 4;
required bytes data = 5;
optional bytes metadata = 6;


Why are data_content_type and metadata_content_type int32 values?

I would expect them to be simply a string like the one used in the HTTP header fields:

Content-Type: application/xml; charset=ISO-8859-4

This would allow to get all the necessary information for handling the byte structure from this header before actually reading it.

It should even possible to allow encrypted or versioned content:

data_content_type: multipart/encrypted; protocol=“application/pgp-encrypted”; boundary="------------24i8m5cu37hapwm904t8v"


data_content_type: application/xml; charset=utf-8; type=MyEvent; version=1.0.2
meta_data_content_type: application/json; charset=utf-8; type=MyMeta; version=1.1.0


content type is there for future expansion and is for known content
types e.g. json=1 xml=2 etc

if you want what you describe ... put it in a header.

Passing it with the header sounds good. Are all customer headers I post stored with the event? If I read multiple events how do I get back the possibly different headers for the events?

I was thinking some explanation might be useful here. So internally ES
does some things based on content type. EG POST Json but GET XML over
http. Another example is projections and can we hydrate this as a
javascript object.

Yes they are in the header byte vector. Store that as a known format
then you can add whatever you want to it (per event or per stream)

I posted this:

POST /streams/mystream HTTP/1.1
Content-Type: application/json
ES-EventId: 8cf7c6bd-c9c5-4c79-8dc5-19943a83d618
ES-EventType: MyEvent
MyCustomHeader-EventVersion: 1.0.1

“a” : “1”


But the custom header “MyCustomHeader-EventVersion” is not returned with;

GET /streams/mystream/0 HTTP/1.1
Accept: application/json


How do I get it back?

see events media type (well and doc in general). If that doesn't work
maybe you can explain more what you are trying to do

btw if not clear post your 'header' as custom metadata

OK, checked again the docs.

Here is what I do:

curl -X POST -H “Content-Type: application/vnd.eventstore.events+json” -d ‘[
“eventId”: “036e30af-d4c5-4c08-852f-0585a84be09b”,
“eventType”: “event-type”,
“myEventVersion”: “1.0.0”,
“data”: {
“a”: “1”
“eventId”: “49d39606-d502-473c-85a6-f4e7fd73d9b8”,
“eventType”: “event-type”,
“myEventVersion”: “1.0.1”,
“data”: {
“a-renamed”: “1”


I added a custom header “myEventVersion”. If I read it back with

curl -X GET


I don’t see it in the result:

<atom:entry xmlns:atom=“http://www.w3.org/2005/Atom”>


<atom:link href=“” rel=“edit” />
<atom:link href=“” rel=“alternate” />
<atom:content type=“application/xml”>




put in metadata not on http request

"metadata": { "whatever": "bar" }

like "data" in your example

Ah OK, so actually there is no way to put it somewhere else. Only meta data.

I originally wanted to avoid this (putting that kind of “content-type” information in the meta data) because I thought there is a way to store it somewhere outside.

content type is internal for event store itself as explained above. We
need it for things like http api JSON->XML conversions

Tnx for the support.