VENTAS: 1-800-867-1389

Create a rule for AppFabric topic using REST API


  • 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}{1}/subscriptions/{2}/rules/{3}", serviceNamespace, topicName, subscriptionName, druleName);


    WebClient webClient = new WebClient();

    webClient.Headers[HttpRequestHeader.Authorization] = token;


    var putData = @"<entry xmlns="""">
    <title type=""text"">testrule</title>
     <content type=""application/xml""> 
        <RuleDescription xmlns:i="""" xmlns="""">
          <Filter i:type=""SqlFilterExpression"">
     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"?





    • Editado manukahn martes, 22 de noviembre de 2011 10:23
    martes, 22 de noviembre de 2011 10:22


  • Hi Manu,

    - try the following:

    <entry xmlns=''>              
      <content type='application/xml'>    
        <RuleDescription xmlns:i="" xmlns="">                 
         <Filter i:type='SqlFilter'>   





    Roman Kiss, MVP Connected System Developer
    • Editado Roman Kiss martes, 22 de noviembre de 2011 23:14
    • Marcado como respuesta manukahn miércoles, 23 de noviembre de 2011 9:04
    martes, 22 de noviembre de 2011 23:11