Search code examples
azureservicebusazure-servicebus-queues

405 Error while sending message to Azure Service bus queue via REST api


I am trying to send a message to Azure ServiceBus queue using REST api via POSTMAN, but when I trigger the message I am getting the below error:-

<Code>405</Code>

<Detail>The SessionId was not set on a message, and it cannot be sent to the entity. Entities that have session support enabled can only receive messages that have the SessionId set to a valid value. TrackingId:aew3fd4-9721d-455456-df56-453345, SystemTracker:SampleNamespace:Queue:queue_name, Timestamp:2019-09-30T10:27:09</Detail>

enter image description here Can someone tell me how can I add a sessionId in header tab, and what to set? I tried a few thing but that did not work.

Thanks, Rudra


Solution

  • The sessionId has to be defined in the broker_properties header

    BrokerProperties:  { “SessionId”: “{Your session ID}”, “MessageId”: “{701332E1-B37B-4D29-AA0A-E367906C206E}”, “TimeToLive” : 90, “CorrelationId”: “{701332F3-B37B-4D29-AA0A-E367906C206E}”, “SequenceNumber“ : 12345, “DeliveryCount“ : 2, “To“ : "http://contoso.com“, “ReplyTo“ : "http://fabrikam.com“,  "EnqueuedTimeUtc“ : " Sun, 06 Nov 1994 08:49:37 GMT“, "ScheduledEnqueueTimeUtc“ : " Sun, 06 Nov 1994 08:49:37 GMT“}
    

    you can find more details from here