Instant Estimate +44(0)1908738254
YOUR EXPERT RPA PARTNER

Team up with our RPA strategy and tech specialists for maximum automation impact

Find out more
Harness the power of UiPath in your business.
WATCH NOW

Save money and spend more time on priority work.

Book consultation
READY, SET, AUTOMATE

Let's choose, design and deploy a process automation solution for your business.

Find out more
TRANSFORM YOUR BUSINESS

Let's analyse your business to discover opportunities for innovation and automation.

Find out more

Begin your business transformation journey

Book consultation
AUTOMATE EVERY FUNCTION

Automate where it matters most. Scale to solve challenges in every area

Find out more
GIVE EVERY TEAM THE TOOLS FOR SUCCESS

Equip people with user-friendly solutions that save time and make work easier

Find out more

Which business problem
can we solve first?

Book consultation
30 March 2017

How to create a REST Service Instance for K2 v4.7 using Swagger

Slowly but surely the world is moving to Cloud-based solutions.  In K2’s latest version, SourceCode added the REST Service Broker to the SmartObject Services Tester tool.  So, how do you create a REST Service Instance in K2?

K2 Automated Testing Software

rnBenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.

 

Free K2 Five Upgrade Review

 

The K2 REST Service Broker – at this moment – only works with Swagger.  You can find more information about Swagger here http://swagger.io/

In the Online Swagger Editor, you can create/edit or extend current Swagger API’s. The Swagger Editor also allows you to generate a server or clients.

1 - Online Swagger Editor
1 – Online Swagger Editor

To view your Web API Methods, you can use the Swagger UI online. Just browse to the Host inside your Swagger File.

2 - Swagger API Methods for K2
2 – Swagger API Methods for K2

The Swagger UI will show you the Methods (Get, Put, Post, Delete)

  • Get = Get Details (List Item)
  • Put = Update Item
  • Post = Create Item
  • Delete = Delete item

Once your API is ready, you can create the REST Service Instance in K2.  The REST Service Instance can be refreshed the same as other Service Instances from other K2 brokers.

3 - K2 Swagger Service Instance using SmartObject Tester
3 – K2 Swagger Service Instance using SmartObject Tester

Creating the Service Instance Requires the Descriptor location.  This location can be a JSON file in a directory or a hosted JSON file online. Just make sure that the Swagger version is at least v2.x.

4 - K2 Swagger Service Instance using SmartObject Tester

4 – K2 Swagger Service Instance using SmartObject Tester

You can select Next and add the desire System and Display name, then you can click on Add to finish the process.

The service instance will now be created.

If you expand the tree of the Service Instance in K2, you will find in the Object Types. The Object Types contain the properties of the specific data model, and the Method will contain all the operations of the Swagger API.

Next, create a SmartObject from a Swagger object type: right click on the Object Type and select Create SmartObject. Select methods and properties you want and publish your SmartObject.

5 - Create K2 SmartObject from Swagger Service

5 – Create K2 SmartObject from Swagger Service

Next, you can then execute the created SmartObject methods bound to the Swagger REST API.

Thats it!  Now you know how to create a K2 REST Service instance in K2 version 4.7

Need further technical advice or support?