Hi, sorry about this but I’m trying to get setup posting events from node.
I am using a curl client that is posting the following
curl --silent --show-error --no-buffer --url http://127.0.0.1:2113/streams/Command --data [{“eventId”:“6c869e00-5943-11e4-8489-0d41e862b024”,“ES-EventType”:“SomeEvent”,“data”:{“ProfileDetailsDto”:{“ProfileId":“475a8e64-6657-48ad-82bd-04c02c47a695”,“Email”:"[email protected]”,“Name”:“Raif the great”,“DisplayName”:“Raif the most exalted one”}},“metadata”:{“CommitId”:“6c86c510-5943-11e4-8489-0d41e862b024”,“CommandClrTypeName”:“ContactVendorForClientCmd”}}] --request POST --location --max-redirs 3 --header Accept: / --header Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 --header Accept-Language: en-US,en;q=0.8 --header Content-Type: application/vnd.eventstore.events+json --user-agent Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)
the code creating it looks like this
var myData = [
{
‘eventId’ : uuid.v1(),
‘ES-EventType’:‘SomeEvent’,
data:{
“ProfileDetailsDto”: {
“ProfileId”: “475a8e64-6657-48ad-82bd-04c02c47a695”,
“Email”: “[email protected]”,
“Name”: “Raif the great”,
“DisplayName”: “Raif the most exalted one”
}
},
“metadata”:
{
“CommitId”:uuid.v1(),
“CommandClrTypeName”:“ContactVendorForClientCmd”
}
}];
curl.request({url:‘http://127.0.0.1:2113/streams/Command’,
method:‘POST’,
headers:{‘Content-Type’:‘application/vnd.eventstore.events+json’},
data:JSON.stringify(myData)
// , pretend:true
},function(err, stdout, meta){
if(err){
console.log(err);
}else{
console.log(’%s %s’, meta.cmd, meta.args.join(’ '))
}
});
this results in not err value but also no post to the event store. However if I do the following
var myData =
{
data:{
“ProfileDetailsDto”: {
“ProfileId”: “475a8e64-6657-48ad-82bd-04c02c47a695”,
“Email”: “[email protected]”,
“Name”: “Raif the great”,
“DisplayName”: “Raif the most exalted one”
}
};
curl.request({url:‘http://127.0.0.1:2113/streams/Command’,
method:‘POST’,
headers:{ ‘eventId’ : uuid.v1(),
‘ES-EventType’:‘SomeEvent’,
‘Content-Type’:‘application/json’},
data:JSON.stringify(myData)
// , pretend:true
},function(err, stdout, meta){
if(err){
console.log(err);
}else{
console.log(’%s %s’, meta.cmd, meta.args.join(’ '))
}
});
this does post the event. again if I use this format with application/vnd.eventstore.events+json it does not.
the end goal is that I want event data and metadata and the former seems to be the way I’m supposed to do it.
If anyone can shed some light on this I would appreciate it.
Thanks,
R