Sending an event with metadata using curl


I followed this manual:

and managed to find the right formula that pushes an event to a stream:

curl -i -d@Event.js “http://localhost:2113/streams/MyStream” -H “Content-Type:application/json” -H “ES-EventType: MyEventType” -H “ES-EventId: b32643e9-a7b8-4221-b33b-df13f9ecfe0c” -u “admin:changeit”

That allows me to send event’s data. I’m wondering how to modify this command in order to be able to include event’s metadata as well.

In order to post an event with metadata, you will need to use Event Store’s custom event content type, “application/vnd.eventstore.event+json”

So you would create your json representation of your event with metadata like so (note that it includes the event ID and type):

“data”: {
“Foo”: “Bar”
“metadata”: {

And post your event using a command like this:

Cool - that works fine. Thank you!