Azure event hub data format documented?

Hi,
I am trying to implement a Photon to Azure Event Hub solution, and followed the samples etc.

So far - I can raise an event and have this sent to my Azure event hub - works ‘darn’ well ;-)). I am well pleased that I can even get this far with the infrastructure doing the grunt work of encryption and encoding my SAS key for me :-))

BUT - is there any actual documentation on how to form the webhook itself ?? Just using a single ‘example’ is not very ‘definitive’ :open_mouth:

Followed the ‘ConnectTheDots’ sample but not sure (without trial and error) how to best format my data. What appears in my Event Hub is ALL the event message - including the named event, plus the raw ‘data’ field PLUS the ‘translated’ JSON :-O.

As I am receiving these queued messages in a C# application - I would rather have total control over what gets sent to the queue, so HOW do I create a simple webhook to just send the ‘data’ content (ie the bit I create on the photon) without all this extra stuff, and expanded JSON.

Below is a sample of what I get into my queue (device ID masked - and line breaks added for clarity) :

{
“event”:“myeventname”,
“data”:"{
“s”:“poolheat”,
“u”:“C”,
“l”:“Alnwick”,
“m”:“Temperature”,
“o”:“Northumbria Systems”,
“t1”: 18.75,
“t2”: 16.00,
“d”:“NSL Test 1”
}",
“published_at”:“2015-10-08T13:00:32.822Z”,
“coreid”:“xxxxxxxxxxxxx”,
“subject”:“poolheat”,
“unitofmeasure”:“C”,
“measurename”:“Temperature”,
“value”:"",
“organization”:“Northumbria Systems”,
“displayname”:“NSL Test 1”,
“location”:“Alnwick”,
“timecreated”:“2015-10-08T13:00:32.822Z”,
“guid”:“xxxxxxxxxxxxxx”
}

All I really want is the bits between the {} after data ???.

Thanks

Graham

OK, so I used ‘trial and error’ and figured it out ;-)).

Just removed the JSON block in the webhook, and now see just the data plus a few other items :

event=myeventname
&data=t1%3A19.75%2Ct2%3A14.12
&published_at=2015-10-08T14%3A44%3A42.939Z
&coreid=xxxxxxxxx

So it just needs decoding and we are good to go :smile: The published_at and coreid will stop me having to include those - so GREAT stuff ;-)). Cuts down the payload VERY nicely…

BR

Graham

Hi @GrahamS,

Sorry about the lack of documentation there! Still very new features :slight_smile: Here’s another example of an Azure Event Hubs webhook, it includes the “noDefaults” param which avoids those 4 default params you noticed:

I hope that helps!

Thanks,
David

David,

Excellent - many thanks I’ll give this a GO then :wink:

Graham

1 Like

Hi,
Follow-up question…
As MS have now officially released their ‘Azure IOT’ Suite’ (sep 29th), are there any docs detailing how we can connect to this service ??. Looking at their site - it seems that (unlike a basic event hub - which I have working :wink: it requires authentication at the device level ??.

This suggests to me that your interface code will need to be sent an individual deviceID and auth code PER DEVICE, so we need some way of passing these values up to the webhook as part of ‘publish’ (or embedded into the data) ???. At present the auth token is part of the webhook code. My guess is that you will NOT want us creating a specific webhook PER DEVICE (if this will even work!! - haven’t tried this yet).

NB I also just did a check and their system DID accept my Particle ID as a device ID :-)), so that should make it a little simpler. BUT the auth code is different to my other newly added device (allowed them to generate a device ID).

Of course this DOES expose the system security as the auth code would have to be passed from the device to you ‘in the clear’ !! - so maybe we need a means to set up a per device auth key which is stored on your system :-O.

Maybe I am missing some vital piece of info somewhere :-O.

Thanks again…
BR
Graham