0 Replies Latest reply on Oct 10, 2011 9:00 AM by shijukk_vda

    Updating a brl asset with REST API

    shijukk_vda

      Hi,

       

      We have been using Guvnor for our project for the last one year. Now we are trying to completely integrate the Guvnor UI as well as do some operation on the guvnor asstes by using REST api.

       

      What we are trying is :

           We are embedding rules into our application using StandaloneEditorServlet and getting the UUIDs through javascript callback functions. After getting UUIDs and name, we are trying to add new conditions to the rules. Also trying to edit some metadata information of the rules.

       

      For tetsting the update BRL functionality with REST API, I am using the code mentioned beow:

       

       

      private void testUpdateBRL(){

        String content = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><asset><binaryLink>http://XXXXXXXX:XXXX/guvnor-5.3.0.CR1-tomcat-6.0/rest/packages/cust_agrmnt/assets/rule_tf_03/binary</binaryLink><checkInComment>test</checkInComment><description></description><metadata><created>2011-09-08T12:12:34.870+04:00</created><createdBy>admin</createdBy><disabled>false</disabled><format>brl</format><lastModified>2011-09-20T10:30:25.353+04:00</lastModified><note> &lt;![CDATA[  ]]&gt;</note><title>rule_tf_03</title><uuid>5b14e3a4-3298-4e1c-a0be-4772a7eb256c</uuid></metadata><refLink>http://XXXXXXXXX:XXXX/guvnor-5.3.0.CR1-tomcat-6.0/rest/packages/cust_agrmnt/assets/rule_tf_03</refLink><sourceLink>http://XXXXXXXXX:XXXX/guvnor-5.3.0.CR1-tomcat-6.0/rest/packages/cust_agrmnt/assets/rule_tf_03/source</sourceLink><type></type><version>8</version></asset>";

       

        String authorizationHeader = "Basic " + org.apache.cxf.common.util.Base64Utility.encode("gues4t:".getBytes());

        System.out.println(content);

        WebClient client2 = WebClient.create("http://XXXXXXXX:XXXX/");

        client2.header("Authorization", authorizationHeader);

      javax.ws.rs.core.Response response= client2.path("guvnor-5.3.0.CR1-tomcat-6.0/rest/packages/cust_agrmnt/assets/rule_tf_03").accept("application/atom+xml").put(content);

      System.out.println(response.getStatus());

      }

       

      I have retrieved the BRL entry format using REST api and set that in to the string 'content' here.

       

      I am getting response status 204, and new version is getting created for the given asset. But the disabled status isnot getting updated -- I am passing false for disabled but still in the guvnor the brl is in disabled condition.

       

      Can anyone help me to find out what is going wrong here....

       

       

      Thanks in advance,

      Shiju.