REST api write event with metadata

I can’t seem to find documentation or example of sending metadata with a new event, using REST api. C# api makes it pretty clear and works as expected, but http api is a mystery…

So if I want metadata to be written along with the event (for the event) how to include? I’ve tried both setting a property in JSON named “metadata” as well as “Metadata” and also as just a shot in the dark, including a header labeled “ES-Metadata”.

See event store event media type here https://github.com/eventstore/eventstore/wiki/Writing-to-a-Stream-%28HTTP%29

Cheers,

Greg

Thanks, got that to work :slight_smile:

I guess best approach for http is to always use custom media type since normal json media type doesn’t offer all the capabilities then. Just to be sure I’m not missing anything else…it appears that when using that custom media type we must always send the events as one or more of a batch.

I.e.

[

{/event here/}

]

Is that correct?

Yes it’s defined as an array

The options are mostly due to functionality vs atom compatibility