Receive data in real time via an API

Hello I have a small question, on my app I retrieve data via an API, then I store these data in my database, I would like to know how I can do that when there is new data on my API, I retrieve them in real time, I would like to avoid loops if possible, I know there are other way but I do not find if someone can help me :slight_smile:

If you are not looping and checking that api periodically, how are you going to know when new data is available?


there are ways to do it, “active callback” and “passive callback” which I think is a loop. But I would like to use the first method “active callback”, but I don’t understand it

Let’s look at what it says:

An active callback is a URL set up on your server which HubRise calls…

What’s a URL in “Django speak”? It’s a view.

You would create a view that is going to accept what HubRise will send you.

but how will Hubrise find my link?

I’m guessing you’ll have to configure it with them somehow. That’s not clear here, so it should be in the more detailed docs for this feature.

it is not possible for django to listen on a URL?

Of course it is - it’s how Django works. What makes you think it doesn’t?

1 Like

@KenWhitesell it was just a question ^^', but how can I make my app listen to a URL and then when there is a new data I get it back

I should amend (correct) this:

More accurately: A URL is a reference to a view.

That means that your application will accept an HTTP request on that URL, and call that view when a request is issued for that URL.

@KenWhitesell I see, but it’s still a little vague, so what do I need to do to configure this?

Configure what, where?

If you’re talking about configuring it with “HubRise”, that would be in their documentation.

If you’re talking about the configuration in Django, the requirements for that would also be in the “HubRise” docs - after all, they’re the ones that are going to be submitting the data to you.

This isn’t a Django issue - you need to find out the details of what their summary is saying.

In fact I do not understand how to make from their docs the configuration on django, it’s that part,

https://www.hubrise.com/developers/api/callbacks/

You create a view to handle the data that hubrise is going to send you.

You assign that view to a URL.

You provide that URL to hubrise as being the active-callback url.

@KenWhitesell I already have a view, where I retrieve data when I make my first Oauth2 connection, can I provide this url or are there things that I must change?

1 Like

You need to create a new view that will accept the data that hubrise is going to provide.