Kentico Notification

avdhoota n asked on March 17, 2017 14:03

Hi,

I am very new to Kentico. I have one requirement, to display the notification to user whenever i get some response from an API which is built on java.

Please let me know the best approach.

Recent Answers


Brenden Kehren answered on March 17, 2017 14:25

Is this a different request that the one you posted here?

I'd check out what Jan suggested.

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on March 17, 2017 14:25 (last edited on March 17, 2017 14:28)

How is the API triggered?

There are multiple methods in general for tracking a notification, all of which usually revolve around ajax.

1: AJAX Long Polling: Use AJAX to request from the API, and wait until either you get a response, or the connection times out in which case you re-initiate the connection.

2: AJAX: Use ajax request to ping the service every X Seconds. The API service should immediately respond with either "not ready yet" or "here's the response." When the response is received it will stop pinging the service of course.

3: WebSocket: Can be a bit more complicated but connects to a service and can transfer data back and forth, it's supported only in more recent browsers (IE 10+): https://en.wikipedia.org/wiki/WebSocket It's not a gaurentee to work on other browsers unless they implemented it.

Good article: http://stackoverflow.com/questions/10028770/in-what-situations-would-ajax-long-short-polling-be-preferred-over-html5-websock

And how to make APIs in Kentico (if you are transfering it to be housed in Kentico vs. java), http://devtrev.com/Trev-Tips-(Blog)/January-2017/Portal-Powered-APIs-and-Feeds But this would only help you in method #2. It takes extra coding to hold a connection (long polling #1) or establishing a web socket (#3)

0 votesVote for this answer Mark as a Correct answer

avdhoota n answered on March 17, 2017 15:26

Brenden Kehren, both are same. Here i wanted to know if there are any other(best) approaches to implement this.

0 votesVote for this answer Mark as a Correct answer

avdhoota n answered on March 20, 2017 09:20

@Trevor, Thanks for your response.

I need to display response received from java API to Kentico. in that case your 'WEB PART TO API CONVERTER' will work to get the response?

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on March 20, 2017 14:26

The Webpart to API Converter will convert any Kentico API into a response (so you can, say, spit out JSON using a repeater and have it render as a text/json response).

If you want to consume a java API and format/display it using Kentico's Transformation engine, my other tool "Universal API Viewer" has the logic and structure that you can consume external API's and convert them into transformable objects (so you can manage the format through the Transformation engine).

I use it in such as a case as an external dealer locator feed was XML, and structured poorly, so i consumed it with the Universal API Viewer so i could transform it into JSON.

This may or may not be the best case, could you be more specific on what your Java API provides? Does it spit out XML, or JSON, and once you receive it, how do you want to display it? The best course of action will be based on that information.

0 votesVote for this answer Mark as a Correct answer

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