Rails 3: How To Keep Track of My API Usage? - ruby-on-rails-3

My app as an API which I have no control of. I don't know which users use it, how many times, etc.
What's the best way of doing an analytics system to keep track of my API usage? Does it need to be a Rack app to filter traffic or there's a better solution for it?
Thanks!

You can create an interface by your self. All you have to do is, trace users by their request to your app and can track records by identifying them by their api key. So a user request to your api will be their usage and so on.

Related

How to get live views count on livestreaming in laravel 9?

I am using co-streamer as a streaming server, also plyr as a video player.
In my mind one approach is to get number of views in a specific method and call in ajax with setTimeInterval method.
But there might be some best way or package to do it?
Any good suggestion about approach or package about views count just like youtube?
You have 2 approaches.
Either you can use socket communication and send back number of live user. You will need some kine of identifier i.e Principal Id if talking in terms of Spring In java
Or as you mentioned use some kind of polling to get counts

Does Instagram API have any endpoint for deleting a media object (photo / video)

I'm trying to delete all the images/videos of my Instagram account without deleting my account. Doing this manually is taking so much time so I thought maybe I can implement a server-side app that send request to API considering the rate constraints etc. But I can't find any endpoints in Instagram API documentation for delete function of media objects.
I wonder if anyone has any knowledge for this purpose ? I saw some 3rd party apps provide this functionality as a paid service, I wonder if anyone know how they are doing this ?
There is no official endpoints can do this. The only DELETE method is for comments. However, if you don't care about the api is official or not, maybe you can try https://github.com/mgp25/Instagram-API/issues/38 .

For Dropbox API is there a way to pull a list of users and see if MFA is enabled?

I am wanting to pull all users in my company dropbox and then check to see if their accounts have MFA enabled. I read over the documentation for Dropbox api but did not see anything stand out where this was possible.
It's very sad to realize that a popular platform such as Dropbox doesn't expose A LOT of basic features through its API (and the SDK itself is far from being OK, compared to G-Suite). Anyway, there are two hacky methods you can use in order to pull out that information (with some limitations).
First method:
By analyzing the team events using team_members_list() you can filter out tfa_change_status_details events. When new_value=TfaConfiguration('[sms|other]', None) is specified - 2FA is enabled.
The information I found out that can be retrieved using this method is:
has_2fa - whether 2FA was ever configured.
is_tfa_enabled - whether 2FA is currently enabled.
tfa_type - whether 2FA is by SMS or by app.
However, keep in mind that you have to track changes constantly and also keep in mind that Dropbox saves team events for only two years.
Second method:
Using the front-end dashboard API this information can be retrieved (I can't remember the API name, I think that it is /2/get_multifactor and inside you'd find some information about its status and the organizational policy regarding 2FA). However, to use the front-end dashboard API (which is totally undocumented) you'd need to simulate a successful login (and correctly use the lid and jar cookies) and you'd also need to bypass the random captcha that appears when you abuse the service with too many requests.
To be honest, Dropbox's API is weak, neglected, and ugly. I wish I never had to use it. Anyway, I would recommend using the first method and pray for a significant update to the API
No, unfortunately the Dropbox API doesn't expose this. We'll consider it a feature request.
There's a feature request open for this one (https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/MFA-status-for-users/m-p/468564#M23886). But I wouldn't hold your breath, as #Aviv mentioned the Dropbox API seems surprisingly neglected at the moment.

Foursquare API limitation and design advice

Foursquare encourages developers to use maximum caching before doing repetitive calls to Foursquare API in order not to extend hourly limit of usage (5000 requests / hour).
So, does it mean is it a bad idea to access Venues API directly from mobile app?
Do we need to make our mobile app retrieve results from our server instead of calling Foursquare directly?
Thanks
Accessing Foursquare using your own servers as a proxy is generally encouraged. As you stated, it's better for caching, but also has the advantages of
being able to make changes quickly without waiting for an app submission (and can therefore propagate to all your users, even ones that don't actively upgrade)
ability to collect and aggregate information about call volume, errors, etc. more easily

Google plus determine changes in network

I am trying to determine changes in the Google+ network in an efficient manner (profile changes). My first idea was to use the eTags of the People.List and People.Get. My assumption was that the eTag in the List (person) would be the same as the one in the Get. This is not the case!
I rather not want to get the details of all the people in the network and checking the eTag for each of them. I will run out of daily api-calls very quickly using that scenario.
Are there any other ways of determining the changes in the network?
Thanks!
I'm not aware of a way to notify your service when changes occur on a user's profile. I don't think that etags will work for what you are trying to do and the client libraries should already be using the etags to manage any query caching. You can perform a few tricks to make queries lighter on your backend though:
Batch API calls
Use a fields filter to just only get the data that matters for your application
If you are running out of quota, you can also request to have your limits raised from the Google APIs console by clicking the Quotas link on the left. The developer relations team from Google+ checks the request regularly and will raise your quota limits if your usage justifies it.