retrieve from data from third party api

Ivan Louw asked on November 4, 2021 06:44

Hi Guys, I need to find the best way to retrieve information that must be displayed in a form or widget from a third party api. And then afterword update the information in the third party api.

The third party application will be on the same net work as the admin site, thus hoping to do the calls through admin as it will be more secure.

Any ideas will be appreciated.

So far I though of using webparts or a global event, but with a global event how do I get the data to the form.

Thanks, Ivan

Recent Answers


kentico guy answered on November 4, 2021 22:19

It really depends on how you want to store the data. You could create a scheduled task that populates the data into a table, then use a macro method or view model (depending on portal vs MVC) to display the data to the end user on the front end.

If it's a quick running API you could just create a macro method (or code behind/view model) that calls another CS file with the standard method of an httpclient and display that data with a webpart or viewmodel.

This is a pretty broad question and I don't know what version of kentico you're running.

0 votesVote for this answer Mark as a Correct answer

Ivan Louw answered on November 4, 2021 23:00

Hi Kentico guy, We are currently running Kentico 12 Sp soon to be upgraded to 13.

The data is not stored in Kentico and will not be stored in kentico due to the sensitivity of the data.

The api will be a be fast. The only thing is that the webpart is in the front end website, where i would like to have the api accessed from the admin part of kentico as our front end is on a different network than the admin.

I basically would like make a api call from the front end but via the admin to retrieve data from a third party api and send the data aback to the third party api.

Thanks, Ivan

0 votesVote for this answer Mark as a Correct answer

Ivan Louw answered on November 4, 2021 23:19 (last edited on November 4, 2021 23:19)

Hi Sorry, Forgot to mention that we using MVC.

0 votesVote for this answer Mark as a Correct answer

kentico guy answered on November 5, 2021 18:15

Probably want to develop a custom widget for the frontend if there's no user input. IF there is user input you'd want to develop a custom form.

https://docs.xperience.io/k12sp/developing-websites/page-builder-development/developing-widgets-in-mvc/example-developing-a-widget-in-mvc

https://docs.xperience.io/k12sp/developing-websites/form-builder-development/developing-form-components/example-developing-a-custom-form-component

For the admin API panel you described you'd want to develop a module https://devnet.kentico.com/questions/create-custom-module-for-admin-ui

In terms of the actual API implementation, you'd use a seperate .cs file to call their API with HttpClient. The authentication can range from attaching a cookie to OAuth. This is pretty much the same across all C#/.NET. You'd call the API and return the data into the viewmodel.

1 votesVote for this answer Mark as a Correct answer

Ivan Louw answered on November 7, 2021 23:15

Thanks for the info, I will play around with all 3 and see which one fits best.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.