Invoking WebAPI from K2 form

  • 12 February 2019
  • 2 replies
  • 2 views

Hi Team,

 

I have a simple data entry screen which is built using K2 Forms, let us say, it has 4 controls, (Name, Age, Gender & DOB).

on click of button (Save button) in K2 form, can i create instance of class with above mentioned input values from user and call a WebAPI which takes this class object as argument.

 

Is there a way to map, these fields to SmartObject (K2 SmartObject with 4 properties as above) and serialize the smartobject to invoke a WebAPI which is hosted on server.

 

let us say,

 

WebAPI signature looks like this;

 

public HttpResponseMessage K2UIExample(User userInstance):

 

I am able to invoke a Web API from smart object, with primitive values as parameters, but how to convert a smart object and request a Web Api, i am facing difficulties.

 

Any pointers or suggestion will be of great help.

 

Thanks,

Nanda Kumar.K

 

 


2 replies

Maybe this will help you
https://help.k2.com/displaycontent.aspx?id=6792

For one of the project we are planning to use K2 UI as front end and REST services as the backend data provider.

 

Wanted to understand the feasibility of the approach, as we have to build K2 UI for transactions screens & user management screens, which will have complex type objects (atleast 4 hierarchy of child items), these must work based on user interactions, which have to call REST API to get or push data to SQL server.

 

Wanted to understand the K2 out of the box REST service broker support in K2 Five, which can invoke these REST services which returns JSON object and binding to K2UI forms.

 

If K2 Five OOTB approach of Invoking Rest services from K2 REST service Broker is prefered in this kind of application development.

 

Thanks,

Nanda Kumar.K

Reply