Tuesday, June 26, 2018

#635 Autonomous OIC --> Process REST API

Some simple examples of leveraging the API here -

I am doing this to familiarize myself with things, before trying out Visual Builder CS integration with process.

Here is a process instance in OIC -




























Now to the REST API -

1.GET /ic/api/process/v1/processes
Retrieves process instance list.



























2. Add comments to the process -

POST /ic/api/process/v1/processes/{processId}/comments

As you can see from the first call, my process id is 30001.





















I validate in the worklist app -
























3. Retrieve a Process Instance

GET /ic/api/process/v1/processes/{processId}






























4. Retrieve the Task List

GET /ic/api/process/v1/tasks





























































5. Get Task 
GET /ic/api/process/v1/tasks/200023

Note the payload returned -

  "actionList": [
        {
            "length": 0,
            "title": "CREATE_TODO",
            "actionType": "System",
            "actionId": "CREATE_TODO"
        },
        {
            "length": 0,
            "title": "VIEW_PROCESS_HISTORY",
            "actionType": "System",
            "actionId": "VIEW_PROCESS_HISTORY"
        },
        {
            "length": 0,
            "title": "SKIP_CURRENT_ASSIGNMENT",
            "actionType": "System",
            "actionId": "SKIP_CURRENT_ASSIGNMENT"
        },
        {
            "length": 0,
            "title": "VIEW_TASK",
            "actionType": "System",
            "actionId": "VIEW_TASK"
        },
        {
            "length": 0,
            "title": "VIEW_TASK_HISTORY",
            "actionType": "System",
            "actionId": "VIEW_TASK_HISTORY"
        },
        {
            "length": 0,
            "title": "START_TASK",
            "actionType": "System",
            "actionId": "START_TASK"
        },
        {
            "length": 0,
            "title": "SUSPEND_TIMERS",
            "actionType": "System",
            "actionId": "SUSPEND_TIMERS"
        },
        {
            "length": 0,
            "title": "UPDATE_TASK_PAYLOAD",
            "actionType": "System",
            "actionId": "UPDATE_TASK_PAYLOAD"
        },
        {
            "length": 0,
            "title": "ACQUIRE",
            "actionType": "System",
            "actionId": "ACQUIRE"
        },
        {
            "length": 0,
            "title": "ESCALATE",
            "actionType": "System",
            "actionId": "ESCALATE"
        },
        {
            "length": 0,
            "title": "WITHDRAW",
            "actionType": "System",
            "actionId": "WITHDRAW"
        },
        {
            "length": 0,
            "title": "OVERRIDE_ROUTING_SLIP",
            "actionType": "System",
            "actionId": "OVERRIDE_ROUTING_SLIP"
        },
        {
            "length": 0,
            "title": "VIEW_SUB_TASKS",
            "actionType": "System",
            "actionId": "VIEW_SUB_TASKS"
        },
        {
            "length": 0,
            "title": "CUSTOM",
            "actionType": "System",
            "actionId": "CUSTOM"
        },
        {
            "length": 0,
            "title": "UPDATE",
            "actionType": "System",
            "actionId": "UPDATE"
        },
        {
            "length": 0,
            "title": "UPDATE_ATTACHMENT",
            "actionType": "System",
            "actionId": "UPDATE_ATTACHMENT"
        },
        {
            "length": 0,
            "title": "UPDATE_COMMENT",
            "actionType": "System",
            "actionId": "UPDATE_COMMENT"
        },
        {
            "length": 0,
            "title": "INFO_REQUEST",
            "actionType": "System",
            "actionId": "INFO_REQUEST"
        },
        {
            "length": 0,
            "title": "REASSIGN",
            "actionType": "System",
            "actionId": "REASSIGN"
        },
        {
            "length": 0,
            "title": "SUSPEND",
            "actionType": "System",
            "actionId": "SUSPEND"
        },
        {
            "length": 0,
            "title": "DECOMPOSE_TASK",
            "actionType": "System",
            "actionId": "DECOMPOSE_TASK"
        },
        {
            "length": 0,
            "title": "DELEGATE",
            "actionType": "System",
            "actionId": "DELEGATE"
        },
        {
            "length": 0,
            "title": "REJECT",
            "actionType": "Custom",
            "actionId": "REJECT"
        },
        {
            "length": 0,
            "title": "APPROVE",
            "actionType": "Custom",
            "actionId": "APPROVE"
        }
    ]

6. Update a Task
PUT /ic/api/process/v1/tasks/{id}

Here I will approve the task we have been looking at -







































7. Create a Process Instance -
























As you can see, I have 2 Start events - Message and Form

Start Message -

POST /ic/api/process/v1/processes

Start Message Payload is as follows -


















REST Request Payload -

The request payload will Require the process name, I need to call the following REST API to retrieve that

ic/api/process/v1/process-definitions




















The value I need is processDefId - 
 "processDefId": "oracleinternalpcs~NewOrgApprovalApp!1.0~NewOrderApprovalProcess",

I also need the Service Name -








 "serviceName": "NewOrderApprovalProcess.service"

Here is the payload -












Wednesday, June 20, 2018

#634 API Design with Apiary

As you probably know, Oracle acquired Apiary quite some time ago.
It complements our API Management story, allowing us to provide full API lifecycle support.















So what do API designers get with Apiary?

A plethora of docs is available here



















Essentially Apiary gives me an Editor that allows me to define and document my APIs.

It also includes a Mock Server, that allows me to run that API, based on my  definition.
I can then give the Mock Server endpoint to my mobile developer, Annie, allowing her to create our compelling mobile app. In the meantime, I can give my service developer, Pat, access to the API definition. He then implements the API. Apiary allows me to sync with GitHub, so I put my API definition there. Pat also uses the same GitHub repository to store the API implementation. 

From within Apiary, we can then use -








Dredd reads your API description and step by step validates whether your API implementation replies with responses as they are described in the documentation.


We then come full circle when we connect our API Definition in API Platform Cloud Service to Apiary.














Now back to API design with Apiary -

I begin by creating a new project -






















Team means others can view/edit the API as required. A team administrator is responsible for setting up teams etc.

Within Apiary itself you have a personal view and a team view.












I go to my newly created API















Left panel - API Blueprint definition

Right panel - Documentation Preview

Updates to the definition are automatically reflected in the preview.

The API is pre-seeded with a dummy "Polls" api definition.
I can amend this to suit my needs -


























The preview - 






















I click on Create a New Order -





























Now I can take the url and test via Postman -


























The very same url I can pass on to my mobile developer, Annie.
You get the idea!

Ok, now I have defined my API, but am I adhering to our corporate standards?

According to Apiary, I am -






But where are these standards set within Apiary?
I can view/edit these, once I have been assigned the Architect role within Apiary.




































Now I will activate the British spelling rule -



Btw. the best English is spoken in Ireland, Dublin in fact.

I can, of course, add new rules to enforce my organisation's style guide.

Next to GitHub synchronisation -

I set this up via the Account page -





















Then I can go back to the Editor  and leverage the GitHub connection


































I choose my /apis repository
















































Now back in the Editor...















Note the Push button above.

Simple yet succinct!

Get started at apiary.io