將一批訊息傳送至服務總線佇列或主題。
請求
方法 | 要求 URI | HTTP 版本 |
---|---|---|
發佈 | http{s}://{serviceNamespace}.servicebus.windows.net/{queuePath|topicPath}/messages|HTTP/1.1 |
要求標頭
下表描述必要和選擇性的要求標頭。 除了列出的屬性之外,標頭還可以包含自定義屬性。 請參閱範例。
要求標頭 | 描述 |
---|---|
授權 | 指定下列其中一個權杖值:
|
Content-Type | 設定為 application/vnd.microsoft.servicebus.json。 |
x-ms-retrypolicy | (選擇性)設定為 NoRetry ,以在發生暫時性錯誤時停用傳送作業的自動重試。 |
要求本文
要求本文包含 JSON 編碼的訊息批次。
回應
回應包含 HTTP 狀態代碼和一組響應標頭。
回應碼
法典 | 描述 |
---|---|
201 | 訊息已成功傳送至佇列或主題。 |
400 | 不正確的要求。 |
401 | 授權失敗。 |
403 | 超過配額或訊息太大。 |
410 | 指定的佇列或主題不存在。 |
500 | 內部錯誤。 |
如您需狀態代碼的相關資訊,請參閱 狀態和錯誤碼。
回應標頭
傳入的內容類型。
回應本文
沒有。
例
下列 HTTP 要求會將三個訊息的批次傳送至佇列或主題。 第一則訊息具有 TimeToLiveTimeSpan 值為 40 秒,第二則訊息具有自定義訊息屬性 “Priority”,而第三則訊息具有自定義訊息屬性 “Priority” 和 “Customer”。
POST https://your-namespace.servicebus.windows.net/HttpClientSampleQueue/messages?timeout=60 HTTP/1.1
Authorization: SharedAccessSignature sr=your-namespace&sig=Fg8yUyR4MOmXfHfj55f5hY4jGb8x2Yc%2b3%2fULKZYxKZk%3d&se=1404256819&skn=RootManageSharedAccessKey
Content-Type: application/vnd.microsoft.servicebus.json
Host: your-namespace.servicebus.windows.net
Content-Length: 18
Expect: 100-continue
[
{
"Body":”This is the first message",
"BrokerProperties":{"Label":"M1","TimeToLiveTimeSpan":"0.00:00:40"}
},
{
"Body":”This is the second message",
"BrokerProperties":{"Label":"M2"},
"UserProperties":{"Priority":"Low"}
},
{
"Body":”This is the third message",
"BrokerProperties":{"Label":"M3"},
"UserProperties":{"Priority":"Medium","Customer":"ABC"}
}
]
服務總線會傳回下列回應:
HTTP/1.1 201 Created
Transfer-Encoding: chunked
Content-Type: application/xml; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
Date: Tue, 01 Jul 2014 23:00:22 GMT
0