Getting list of all projects or batches with MTurk API - mechanicalturk

I am creating an application where I need to
1. Fetch the list of projects/batches currently a requester has in his account.
2. Based on the batch/project ID I need to fetch all HITs under that batch.
Is there any MTurk API to do this task ?
I was going through this MTurk API documentation but did not get any such API.

The API does not support batches. Those should be considered features specific to the Requester User Interface (RUI) (i.e., the web interface).
HITs from a batch have a RequesterAnnotation value of something like "BatchID:123456;". This can be used to identify HITs via API operations, but there are no operations that automatically work on a batch.

Related

How to throttle the amount of request to an API?

There is a crm system, which provides webhooks to notify about some events happening in it (for instance, user creates some entity or moves it to the next 'status'). At some event a webhook triggers my script, that creates a new entity in this crm system using it's API. The system's API has a rate limit – 7 request per second. By violating this rule the access to the API may be restricted for the account for some time.
The problem is, that if user changes 'status' of 1000 entities the webhook triggers my script 1000 times, so it calls the API 1000 times and that may violate the rate limit. Is there any way to temporarily 'store' all requests that came from the webhook and then launch the script no more than n-times per second?
The script is written in php and is located on my Apache server now, but later it may be put on client's server or somewhere else.
I've read about Rabbit MQ and Kafka. But it seems to be an overkill for this task. Or maybe it's OK? I just don't have enough experience with these systems.
Any help would be appreciated.

REST APIs to fetch statistic api usage data from API Connect

This may look a dumb question to you. However, I am looking for a way to fetch API Connect internal data i.e. number of invocations of APIs exposed via API Connect , by which client etc. I know, there are individual dashboard/chart within API Connect. But, I want to build a explicit tool to monitor the same leveraging API Connect data.
is it at all possible ?
Thanks in advance
See the KC at https://www.ibm.com/support/knowledgecenter/SSMNED_5.0.0/com.ibm.apic.apionprem.doc/rapim_analytics_apieventrecordfields.html which will explain how to get the info you want.
Procedure
To obtain analytics data for a Catalog and API provider organization, issue the following call:
GET /v1/orgs/{orgId}/environments/{envId}/events
where
{orgId} is either the URL path segment or the ID of the API provider organization.
{envId} is either the URL path segment or the ID of the Catalog.
The following example shows a call that is issued from a browser and then shows all the event fields in the corresponding response. The call is issued to return two analytics events (limit=2), and includes a next parameter for requesting further events.
https://api-manager-server.company.com/v1/orgs/macs-shack/environments/sb/events?next&limit=2

Yammer API - rest api rate limits

Apologies if this question has already been asked.
I have followed this guide to create a script that will bulk delete members from a specified Yammer group and I have this working perfectly.
The process used at the minute is obtaining a token for a user, then using that token to remove the user from the group, which takes two API calls.
My question is about "sleeping" to avoid tripping the rate limiter. On the documentation for the Yammer API rate limits (link) it states that "rate limits are per user per app".
In another stackoverflow question (link) it's mentioned that in this context, the user refers to the user token.
Since in my script, I'm only using a single API call per user token (to remove the user from the group), is it necessary implement a sleep to avoid tripping the limit?
I'm also wondering whether the API call to retrieve the token for a user may possibly trip the limiter since it's called using the admin token?
I've run a few tests removing 52 users from a group using a script without any "sleeps" and it completed successfully in around 27 seconds, just trying to understand why this didn't break the limiter.
Thanks in advance!
is it necessary implement a sleep to avoid tripping the limit?
Yes, the admin user (or token if you like) could trip the limit in this case. To be on the safe side, that is, to avoid your app from being (manually or automatically) blocked, you shouldn't make more than request per second to Yammer endpoints that are categorised under "Other Resources". That's the Official guideline.

Create a new scheduled Tweet via the API

I looked into their documentation and they do provide this feature:
https://support.twitter.com/articles/20170532-scheduled-tweets#How_to_create_a_new_scheduled_Tweet
But would it be possible to do this through the API (I didn't find any reference to this or attributes).
There's no way to do it with the Twitter API. You have two choices:
Either tell your code to run at a specific time (using cron or similar), or check what the time is before posting.
Use a third party service like Buffer - https://bufferapp.com/developers/api
This can be done using Twitter Ads API(scheduled tweets api).
From the api doc,
Scheduled Tweets allow an advertiser or user to create a Tweet that can be scheduled to go live at a later date. In addition to being able create and manage these Tweets, the API allows the ability to associate these Tweets with a line item, to be promoted once the Tweet goes live. This allows advertisers to stage create native Tweets and plan their campaign creatives in advance of any key initiatives. For example, staging a Tweet creative to live immediately upon a new product announcement.
The full set of functionality provided by the Scheduled Tweets API endpoints are listed below:
Create, modify and view newly scheduled Tweets
Associate a Scheduled Tweet with a line item
Query and manage existing scheduled Tweets
Once a Scheduled Tweet goes live, retrieve the live Tweet id
Complete details can be found here
You can create a Scheduled Tweet for the account's full promotable user (default) or the user specified in the as_user_id parameter.
https://developer.twitter.com/en/docs/ads/creatives/api-reference/scheduled-tweets#post-accounts-account-id-scheduled-tweets
There is a limit of 5 user per account... even with a developer account you have to request acces to that API.

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.