Jahia in English > Publishing via REST...

0 (0 Good)
0 (0 Bad)

Publishing via REST api

by  sbarriball »  2014/08/05 14:59

Could someone tell me how i can trigger a publish on a newly created item over the REST api.

Im succesfully creating/updating content by doing a PUT to the REST api

e.g. 

PUT http://localhost:8080/modules/api/jcr/v1/default/en/nodes/e988d6ed-d4be-4b77-95a8-973e522ba4ff

but cannot see how i can auto publish this.

 

  • Publishing via REST api
    2014/08/05 14:59

    sbarriball <p>Could someone tell me how i can trigger&nbsp;a publish on a newly created item over the REST api.</p> <p>Im succesfully creating/updating content by doing a PUT&nbsp;to the REST api</p> <p>e.g.&nbsp;</p> <p>PUT http://localhost:8080/modules/api/jcr/v1/default/en/nodes/e988d6ed-d4be-4b77-95a8-973e522ba4ff</p> <p>but cannot see how i can auto publish this.</p> <p>&nbsp;</p>

  • Number of messages  10
    Registration date Aug 5, 2014
    0 (0 Good)
    0 (0 Bad)

    Re: Publishing via REST api

    by  sbarriball »  2014/08/07 16:03

    I solved this by adding rules to the rules.drl file in my module.

    >>>

    rule "Auto publish on create"

       when

          A new node is created

           - the node has the type irr:companyNote

        then

    >       service.publishNode(node, drools);

    end

     

    rule "Auto publish on status update"

       when

        A property status has been set on a node

           - the node has the type irr:companyNote

        then

    >       service.publishNode(node, drools);

    end

  • Re: Publishing via REST api
    2014/08/07 16:03

    sbarriball <p>I solved this by adding&nbsp;rules to the rules.drl file in my module.</p> <p>&gt;&gt;&gt;</p> <p class="p1"><span class="s1">rule</span><span class="s2"> </span>&quot;Auto publish on create&quot;</p> <p class="p2"><span class="s2">&nbsp;&nbsp; </span>when</p> <p class="p3">&nbsp; &nbsp; &nbsp; A <span class="s1">new</span> node <span class="s1">is</span> created</p> <p class="p3">&nbsp;&nbsp; &nbsp; &nbsp; - the node has the type irr:companyNote</p> <p class="p3">&nbsp; &nbsp; <span class="s1">then</span></p> <p class="p3">&gt; &nbsp; &nbsp; &nbsp; service.publishNode(node, drools);</p> <p class="p2">end</p> <p class="p4">&nbsp;</p> <p class="p1"><span class="s1">rule</span><span class="s2"> </span>&quot;Auto publish on status update&quot;</p> <p class="p2"><span class="s2">&nbsp;&nbsp; </span>when</p> <p class="p3">&nbsp;&nbsp; &nbsp;A property status has been set on a node</p> <p class="p3">&nbsp;&nbsp; &nbsp; &nbsp; - the node has the type irr:companyNote</p> <p class="p3">&nbsp; &nbsp; <span class="s1">then</span></p> <p class="p3">&gt; &nbsp; &nbsp; &nbsp; service.publishNode(node, drools);</p> <p class="p3">end</p>

  • Number of messages  10
    Registration date Aug 7, 2014
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page