Create a rule for AppFabric topic using REST API
-
martedì 22 novembre 2011 10:22
I am trying to create a rule for an AppFabric Topic subscription using REST API.
First I create a topic, then I create a subscription and finally I want to create a rule that will filter messages for my subscription.
I succeeded to create the topic and the subscription but when I sent the PUT request to create the rule I Got a 400 error – "Bad request".
var ruleAddress = string.Format("https://{0}.servicebus.windows.net/{1}/subscriptions/{2}/rules/{3}", serviceNamespace, topicName, subscriptionName, druleName);
WebClient webClient = new WebClient();
webClient.Headers[HttpRequestHeader.Authorization] = token;
var putData = @"<entry xmlns=""http://www.w3.org/2005/Atom"">
<title type=""text"">testrule</title><content type=""application/xml""><RuleDescription xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""http://schemas.microsoft.com/netservices/2010/10/servicebus/connect""><Filter i:type=""SqlFilterExpression""><SqlExpression>To='myvalue'</SqlExpression></Filter></RuleDescription></content></entry>";webClient.UploadData(ruleAddress, "PUT", Encoding.UTF8.GetBytes(putData));Does anyone know where I can find an example that demonstrates how to create a rule using the REST api? Or even better does anyone know why do I get the "Bad request Error"?
Thanks
Manu
Manu- Modificato manukahn martedì 22 novembre 2011 10:23
Tutte le risposte
-
martedì 22 novembre 2011 23:11
Hi Manu,
- try the following:
<entry xmlns='http://www.w3.org/2005/Atom'> <content type='application/xml'> <RuleDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect"> <Filter i:type='SqlFilter'> <SqlExpression>To='myvalue'</SqlExpression> <CompatibilityLevel>20</CompatibilityLevel> </Filter> </RuleDescription> </content> </entry>Thanks
Roman
Roman Kiss, MVP Connected System Developer- Modificato Roman KissMVP martedì 22 novembre 2011 23:14
- Contrassegnato come risposta manukahn mercoledì 23 novembre 2011 09:04

