Create K2 Smart Objects for Muhimbi Converter Service Online REST API

  • 1 October 2019
  • 0 replies
  • 735 views

This is in continuation to my previous post-K2 cloud REST service broker integration with Muhimbi Converter Service Online. In this blog, let’s create the most significant features of the K2 platform “SmartObject”.

 

So what is SmartObject?

A SmartObject is actually nothing more than a set of instructions that maps various properties and methods for a logical object to equivalent properties and methods in a data source, using a specific broker (That’s sound too Complicated, Don’t Worry❗️). This blog will help you create SmartObject method which will help convert documents to PDF file and trust me, it’s not that difficult as long as these instructions are followed very carefully.

 

Before we begin:

  • Make sure the following prerequisites are in place.
  • Muhimbi Converter Service Online Integration facilities have been configured.
  • Appropriate privileges to K2 Management portal and K2 Designer.
  • The individual should have intermediate knowledge on how to use K2 designer and create SmartObject.


STEP 1: Open K2 Designer and Click on CREATE “SmartObject”.

STEP 1.jpg

 

 

STEP 2: Click on the General tab and then select the Advanced SmartObject option and Click on Create.

 

STEP 2.jpg

 

STEP 3: Click on Methods Tab and Click on Add.

 

STEP 3.jpg

 

STEP 4: On the Properties and Method with the ‘SELECT A SERVICEOBJECT METHOD’, selected click on ‘Converter Service Online(Production) > Convert data > Serialize and then click on NEXT.

 

STEP 4.jpg

 

STEP 5: On the DETAILS screen, leave all values as default and Click on NEXT.

 

STEP 5

 

STEP 6: With INPUTS & OUTPUTS selected, click on ‘Create ALL‘. But Don’t click on NEXT.

 

STEP 6

 

STEP 7:

  • On the same(‘INPUT & OUPUTS’) screen.
  • Select the Serialized Item(String) INPUT PROPERTY and set the “SmartObject property” to “Source_File_Content”.
  • Click on OK and then NEXT.

STEP 7.jpg

 

STEP 8: On the SERVICEOBJECT METHODS screen, click on FINISH.

 

STEP 8.jpg

 

STEP 9: The ‘Convert data’ request method must look like the screenshot below.

 

STEP 9.jpg

 

Now that we have configured the “Convert Operation REQUEST”, let's Configure the Operation Response.

 

Step 10: Double Click on the Serialize Method, the following screen appears.

 

STEP 10.jpg

 

Step 11: On the SERVICEOBJECT METHOD tab with “Convert data: Serialize” Method selected, click on Add.

 

STEP 11

 

STEP 12:

  • When you click Add button the following screen below opens.
  • On the ServiceObject method click on the ellipses (…).

STEP 12.jpg

 

STEP 13: Select the ‘Convert‘ method under ‘Operation response‘ for Muhimbi Converter Service Online(Production) > Object Type and Click OK.

 

STEP 13.jpg

 

STEP 14:

  • With the ServiceObject method > ‘Converter Service Online(Production) Operation response.Convert‘ selected click on ‘Create All’.
  • But Don’t ❗️ Click on NEXT.

STEP 14.jpg

Step 15:

  • On the same screen (‘INPUT & OUPUTS’) selected.
  • Select the Input_data(Convert_data) property and set the “SmartObject property” to “Source_File_Content” click on OK.
  • On the Add ServiceObject method binding screen again on OK
  • On the Edit Method screen click on FINISH.

STEP 15.jpg

 

Step 16:

  • Your final SmartObject should look like, the screenshot below.
  • Click on ‘Save and FINISH’.

STEP 16.jpg

 

Congrats you have successfully created your first “Convert to PDF(Muhimbi)” SmartObject.

 

Now it’s time to TEST our SmartObject ?.

  • Navigate to K2 Management portal > Categories > REST > ‘Convert to PDF(Muhimbi)’.
  • Scroll down the page and select the ‘Serialize’ method and Click on ‘Execute’.

STEP 17.jpg

 

Fill in the Mandatory parameters and click on ‘Execute‘.

 

Sample data:

  • Source_file_name: clavin.txt
  • Source_file_content (Base64 String): TXVoaW1iaSByb2Nrcw==
  • Output_fomat: PDF

STEP 18.jpg

 

Hurrah ‘Success’ ?….

 

STEP 19

 

Now that we have configured our first Smart-Object and Tested it, in the next blog we will create our First Workflow using the SmartObject.

 

Subscribe to my blog for the latest updates about SharePoint Online, Microsoft Flow, Power Apps and document conversion and manipulation.


0 replies

Be the first to reply!

Reply