azureazure-eventhub

HTTP POST between Postman and EventHub


Can someone help me. I want to send data from Postman (Chrome APP) to my EventHub via HTTP POST. I was successful a while ago but have lost the documentation.

I have the following credentials: EventHub URL in the form https://NAMESPACE.servicebus.windows.net/EVENTHUBNAME/messages

DataSend name

DataSend key

Thanks


Solution

  • We recently updated our REST documentation - guess SEO is taking its sweet time.

    Here's the documentataion.

    Most crucial among all is to generate the SharedAccessSignature token. Use: SharedAccessSignatureTokenProvider.GetSharedAccessSignature() or SharedAccessSignatureTokenProvider.GetPublisherSharedAccessSignature() from ServiceBus SDK to generate it, based on your scenario. Here's the sample Rest request:

    POST https://SBNAMESPACE.servicebus.windows.net/EVENTHUBNAME/messages
    
    HEADERS:
    Authorization: SharedAccessSignature sr=sb%3a%2f%2fSBNAMESPACE.servicebus.windows.net%2fEVENTHUBNAME%2fPublishers%PUBLISHER_NAME&sig=%2bbkNx23XC%2bWiFjD7%2bZi8qcDULdcnOEdLuef4dgEulx8%3d&se=1473789915&skn=RootManageSharedAccessKey
    Content-Type: application/atom+xml;type=entry;charset=utf-8
    x-ms-retrypolicy: NoRetry
    
    BODY:
    { "DeviceId":"dev-01", "Temperature":"37.0" }
    

    Here's a code Example to create the SharedAccessSignature & avoid calling SERVICEBUS SDK.