Are there REST APIs for lifecycle, workflow and custom methods?

Hi Aras Team,

I am trying to user ARAS Rest APIs. So I have some questions - 

1. I have created an ItemType that has custom action method, can we call this custom method using REST API by passing instance item id and method name?

2. Lifecyle - Do you have REST APIs for LifeCycle e.g to promote state from one state to another state?

3. Workflow - Do you have REST APIs for Workflows

Thanks

Vinay

Parents
  • Hi Vinay,

    The short answer is yes. I'm planning a blog post soon that will cover calling methods from the REST API in more detail, but I can give you the highlights here.

    Every method call via the REST API will be sent as a POST request. The body that you send along with the post request will be treated as the context item for the method. The general structure of this can be seen below

    POST {base url}\method.YourMethodName
    {
        "your_property_name" : "Your Property Value"
    }

    As a real world example of this, we can take a look at how to promote a Document to the Released state. The AML for this call would look something like this.

    <AML>
      <Item type="Document" action="promoteItem" id="84BA9AFB58B84FA5B3CCC840A3B8BFEB">
        <state>Released</state>
        <comments>Promote this item to released as a test</comments>
      </Item>
    </AML>

    This AML query is running an action called promoteItem on a Document based on the ID. Looking at this, we can see that the method name we would need to use is called promoteItem. We'll also need to pass in our state and comments via the body of the request that we send to the server. Lastly, we'll need to call this method on a specific item. We can put all of these together to make a call that will look something like this.

    POST {base url}\Document('84BA9AFB58B84FA5B3CCC840A3B8BFEB')\method.promoteItem
    {
        "state" : "Released",
        "comments" : "Promote this item to released as a test"
    }

    Workflow voting get a little trickier. You can see the general structure of an AML request to vote on a workflow here. This request makes heavy use of attributes on properties which is currently not supported via the REST API. For workflow voting, I'd recommend writing a custom server method that handles building the request based on some information and then calling that instead of the standard EvaluateActivity action.


    Chris

    Christopher Gillis

    Aras Labs Software Engineer

Reply
  • Hi Vinay,

    The short answer is yes. I'm planning a blog post soon that will cover calling methods from the REST API in more detail, but I can give you the highlights here.

    Every method call via the REST API will be sent as a POST request. The body that you send along with the post request will be treated as the context item for the method. The general structure of this can be seen below

    POST {base url}\method.YourMethodName
    {
        "your_property_name" : "Your Property Value"
    }

    As a real world example of this, we can take a look at how to promote a Document to the Released state. The AML for this call would look something like this.

    <AML>
      <Item type="Document" action="promoteItem" id="84BA9AFB58B84FA5B3CCC840A3B8BFEB">
        <state>Released</state>
        <comments>Promote this item to released as a test</comments>
      </Item>
    </AML>

    This AML query is running an action called promoteItem on a Document based on the ID. Looking at this, we can see that the method name we would need to use is called promoteItem. We'll also need to pass in our state and comments via the body of the request that we send to the server. Lastly, we'll need to call this method on a specific item. We can put all of these together to make a call that will look something like this.

    POST {base url}\Document('84BA9AFB58B84FA5B3CCC840A3B8BFEB')\method.promoteItem
    {
        "state" : "Released",
        "comments" : "Promote this item to released as a test"
    }

    Workflow voting get a little trickier. You can see the general structure of an AML request to vote on a workflow here. This request makes heavy use of attributes on properties which is currently not supported via the REST API. For workflow voting, I'd recommend writing a custom server method that handles building the request based on some information and then calling that instead of the standard EvaluateActivity action.


    Chris

    Christopher Gillis

    Aras Labs Software Engineer

Children