REST API - Best practice for 'real time' data - api

I am developing a dashboard where all (direct) messages, tweets, etc directed at the user will be displayed in one dashboard. All the social media vendors have (OAuth) Rest APIs.
When developing a 3rd party program for an service like Twitter. Is it good practice to request data from the service's API every X milliseconds/seconds, or is there a better way?

It depends on which Twitter API you are interested in. Most of the REST API endpoints have published rate limits found here. If any of these suit your needs, then you would calculate the appropriate frequency of requests that would keep your from exceeding the rate limit.
Alternatively, if you are accessing Twitter's Streaming API, you would never close the connection.

Related

Is there possibility to forward content from WhatsApp to our application using business api?

Is it possible to use the WhatsApp business API to communicate with users and also allow them to forward content from WhatsApp directly to our application. For example enabling Web-hooks for different WhatsApp channels to receive the messages from those channels. If yes, can someone guide me how can we implement this feature? and how can we authorize those channels with our WA business account
Finding sources/documentation for developing needed feature
Whatsapp API allows you to Broadcast messages to Unlimited Users, automate notifications, integrate Chatbots, provide Live Chat on Multiple devices and many more functions. Install the WhatsApp Business API Client and then Install your API client. Once your client is working, you can update your application settings. Start using the client, Register your phone number with an API call to /account and send a test message with a call to /messages . let me know if u find this helpful.
Yes, it is possible. The WhatsApp Business Platform allows medium and large businesses to communicate with their customers at scale. Using their APIs, businesses can connect thousands of agents and bots to interact with customers programmatically and manually. Additionally, the APIs can be integrated with numerous backend systems, such as CRM and marketing platforms
Here is the link for the documentation: https://developers.facebook.com/docs/whatsapp/overview
Link for different types of webhooks:
https://developers.facebook.com/docs/whatsapp/webhooks
There are multiple ways given in the documentation. But keep in mind, do read the documentation carefully, they have their updated and the previous version so use them as per your requirements.

Getting information about many users using Spotify's API

I've looked briefly through Spotify's API documentation to try and see what exactly can be done with the API. I'm trying to do some data analysis on Spotify data, specifically on user listens / user playlists. However, as far as I can tell, the only way to uncover that information is through OAuth, and each user whose play information I desire would need to explicitly grant permission to my app to use their information. Since I am not building a user-facing app and am interested in doing mass analysis on many users at once, I don't think this would work for my purposes.
My question - is there any way to return multiple users' listening habits through a script that pulls data from Spotify using its API? Or is that possible strictly by way of an application that one user at a time gives authentication to when they load an app that uses this API?
is there any way to return multiple users' listening habits through a script that pulls data from Spotify using its API?
Spotify doesn't expose users' listening habits unless they authorized the app requesting it (I think this is what you meant when you said "through OAuth"). There's pretty big privacy reasons for not exposing users' data to the world.

Is it standard to make each user sign up for a 3rd party API key?

I want to make a desktop application which will need to use a 3rd party REST API to get information. However, the number of requests is limited by the API Key. If I use one API key for all users, the request quota will be exhausted really fast. Now, is it standard (and legal) to make each user sign up for his/her own API key? How are API keys used in context of open-source projects?
To generate the API key, I want to make a sign up form within the application, where the user puts in his/her information and the application sends those information to the 3rd party website to get an API key. Does that sound right?
In general the use of an API is limited to the requests from one machine and not to the API key most of the time.
Again depending of the type of third party services you are using, but the requests to the service should be established by the client not the server.
For example if you want to know geographic coordinates from a specific place, but obviously you can't ask the user directly for GPS coordinates. So you implement the Google Maps Javascript Library into your app which requests the Google API for the coordinates to the human readable address and returns it to the client. This in turn sends the data to your server.
In this way your server never comes into contact with the third party service.
If you have sensitive data or data which shouldn't be manipulated by the user you have to request from your server directly of course. But take a look into the documentation of the service before hack something together which isn't in the intention of the service provider.
Never ever try to outwit a service provider. They will detect your inappropriate use and block you for all time!

What are the limitations of OneDrive for Business APIs

As per the documention of the OneDrive API https://dev.onedrive.com/README.htm, under the Throttling option, "OneDrive has limits in place to make sure that individuals and apps do not adversely affect the experience of other users. When an activity exceeds OneDrive's limits, API requests will be rejected for a period of time. OneDrive may also return a Retry-After header with the number of seconds your app should wait before sending more requests."
So i would like to know what are the limitations that causes the OneDriveApi to reject request
Based on how use the API many requests to it or if you are trying to do something that the user is not info need abt

Is the Twitter Search API affected by the recent Twitter API changes?

I've been building an app which allows the user to search through recent (i.e. 6-9 days worth) public tweets on Twitter using the Twitter Search API.
Currently, the site is entirely public - that is, users do not need to sign in to Twitter (or even be Twitter users at all) to use my app.
However, the upcoming changes to the Twitter API have left me confused, particularly the fact it would appear that every request to Twitter's API will need to be authenticated.
My limited understanding of how Twitter's API works is that I need to authenticate my app using OAUTH, which in turn means that, if I want to continue accessing the Twitter Search API, users will need to sign in to my site before they can use the functionality related to the Search API - hence, only Twitter users will be able to use that section of my app.
Am I understanding this correctly, or is the Twitter Search API exempt from the changes? If I authenticate my app, does this mean the rate at which users can search Twitter status updates through my app is increased (or any other advantages over having non-authenticated apps)? Note that I am currently implementing a caching feature to cache related searches.
Thanks!
The changes to the Twitter API would affect your application depending on how your application works. These are the changes that you should be aware of:
All requests used to be anonymous. Now, all requests must be authenticated via OAuth.
With the old rate limits, according to my tests, you where able to make about one request per second per IP address. Now you can make 180 requests per 15 minute block per authenticated user (1 request every 5 seconds on average).
Not related, but still worth mentioning, the data that the new API returns is more similar to the data that the Streaming API returns. It's much more complete.
So, according to these changes, if your application uses some kind of a bot which polls the Search API, stores the results into a database, and then your users search within these stored results; you will have to implement OAuth with your own access token, which you can get by creating an application at dev.twitter.com.
But, if your application connects to the Search API every time that your users interact with it, and you think that you will have to make more than one request every 5 seconds on average, then you will have to ask your users to authenticate in order to get their access tokens for your requests.