Search code examples
eventstoredb

What is a valid eventId in EventStore?


When I try to post an event without an eventId, I get:

HTTP/1.1 400 Empty eventId provided.

If I populate eventId with something random, then I get:

HTTP/1.1 400 Write request body invalid

In the stdout of the server, I see:

Error converting value "foo" to type 'System.Guid'

What does it take to get a valid EventId?

command:

curl -i -d @event.json localhost:2113/streams/birthday-offer \
     -H "Content-Type:application/vnd.eventstore.events+json"

event.json:

[
  {
     "eventId": "foo",
     "eventType": "bar",
     "data": { 
       "who": "11111111111",
       "which": "birthday-offer"
     }  
  } 
]

I'm not in a .NET language.


Solution

  • Just in case anyone else comes across this question, the answer is EventId is a Guid.

    According to the docs, you can even omit the EventId and the server will provide the Id for you.