How to call the third-party api in restful style


#1

Hi,
The options in the applications section are exclude the restful api
How can we call a restful api and get such as json format data which can be use in process?
Thank you!


#2

Hi, Tim.

There are multiple types of applications that you can use where you can implement REST API calls.
You can use the Assembly application for example.

1- Create your Class Library in Visual Studio where you’ll be able to launch your REST API call and make sure the object returned represents your JSON string.
2- Build the application and copy all the assembly files (.DLL) to ~\wfgen\bin
3- Create the application by indicating the name of your assembly file (ASSEMBLY_NAME.DLL) and the method used that returns the JSON string.

For more information regarding applications, kindly consult the following documentation:
https://advantys.gitbooks.io/workflowgen-administration-module-reference-guide/content/global-information.html

Best Regards,
Eddy.


#3

Hi Eddy
Thanks for reply, I have already add the .dll files and applications
How to use this application in the process, I want to show a drop-down list with the values returned from this application

This article does not show the detail in embed application to process


#4

Hi, Tim

Since the returned value is a JSON string, you will need to retrieve the value in the .NET code-behind editor and bind the dropdown on page load.

One way to do it is to create a hidden TEXTBOX field and map the RETURN_VALUE data as a VALUE IN to that textbox.

Then in the .NET code behind editor, right after the page load, you can retrieve the JSON string and perform a databind to the desired dropdown list.

protected void Page_Load(object sender, EventArgs e)
	{
	    base.Page_Load(sender, e);
            // retrieve JSON string from hidden textbox and bind dropdown list
	}

Best Regards,
Eddy.


#5

Hi Eddy

How to map the RETURN_VALUE to the hidden TEXTBOX ?
Thanks


#6

Hi Tim,

In the Form Designer,

1- Click on Mapping
2- Click on the action where you’re supposed to retrieve the returned value
3- Click on the VALUE IN of the textbox and select the data RETURN_VALUE.

Best Regards,
Eddy.


#7

Hi Eddy

I already map the RETURN_VALUE to the hidden TEXTBOX by add a new action with my application type and set the VALUE_IN to the TEXTBOX, but there was no value show in the field
Is it possible to run a small test for the specific application in workflowgen?

.dll source code

public static string getMember()
{
var url = “https://jsonplaceholder.typicode.com/posts”;
var client = new RestClient(url);
IRestResponse response = client.Execute(new RestRequest());
Console.WriteLine(response.Content);
return response.Content;
}


#8

Hi Eddy

Can you help me?
Thank you.


#9

Hi Tim,

Sorry for the delay.
Kindly open a new ticket on our Helpdesk so we can assist you with your issue.

Best Regards,
Eddy.