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.
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.
To view your Web API Methods, you can use the Swagger UI online. Just browse to the Host inside your Swagger File.
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.
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
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
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