Sending an event with metadata using curl

Hi,

I followed this manual:

http://docs.geteventstore.com/http-api/3.0.0/writing-to-a-stream/

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

curl -i [email protected]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):

[
{
“eventId”:“6b98dfef-7ffb-49d5-9017-c3788508f986”,
“eventType”:“MyEventType”,
“data”: {
“Foo”: “Bar”
},
“metadata”: {
“$maxAge”:“2000”,
}
}
]

And post your event using a command like this:

Cool - that works fine. Thank you!