Mechanical Turk - API created hits are not shown under batches - mechanicalturk

I've created around a few hundred HITs using a Python API, but they aren't shown under the manage -> results.
Is there a way to view HITs created by Python?

The ability to see HITs created through the API (regardless of language used) was removed from the website in December 2017. This blog post describes a workaround, using the AWS CLI, to see these HITs.
https://blog.mturk.com/upcoming-changes-to-the-mturk-requester-website-and-questionform-data-format-f7c3238be58c

Related

Cannot see my MTurk HIT (as a worker) created from the API using boto3 and Python

I am planning to do a large scale crowdsourcing experiment on MTurk and would therefore like to do this using the API and Python, since I am very interested in the ReviewPolicies Feature. I tested this (not only in the sandbox, but also in the marketplace) and can't find my created test HIT (reward set to 0.01).
What could be the reason for this? Also I read in in some prior tasks, that HITs created with the API are not visible in the developer interface. But they must be visible to workers on the website interface, aren't they? If not, how will these HITs be found by workers on the dashboard/marketplace?
I published the HIT successfully on the marketplace (API) and I can see the HIT response. I expected to find this specific HIT also on the dashboard (signed in as a worker).

Amazon Mechanical Turk: Created a Job using website UI, but would like to accept/reject jobs using the Python API

I created a data collection Job (HITs) using the mechanical turk website.
I would like to reject/approve jobs using python API, because that would accelerate the process.
I can approve the process using the python API, but that doesn't update the Assignment status on the website. Does anyone have any idea on this?
Thanks.
Unfortunately, HITs created through the website are not visible or manageable in the UI (and vice-versa). So, that's why you can't see or operate on them via API calls. You'll need to create the HITs
You can reuse the layouts created in the website, though. Check out this article: https://blog.mturk.com/tutorial-using-the-mturk-requester-website-together-with-python-and-boto-4a7ef0264b7e

Can you create Google Forms from Google Docs in an application?

I am thinking about app that will use google form and I need to create forms from that app. Is there a way how can I create form in google docs without using website but through some api or some other way?
I can offer an idea for a solution using Google App Script.
Since the beginning of 2013 you can create new forms using the App Script Forms Service API quite easily.
var form = FormApp.create(title)
.setDescription(description)
.setConfirmationMessage('Thanks for responding!')
;
The problem now is how to get that App Script running from your non App Script code.
You can use App Script to create a Web App that reacts to HTTP GET requests.
So putting it together, you may be able to create an App Script Web App that reacts to a GET request and when it gets the right URL parameters, it creates the form.
(Nov 2020) Yes, it is possible to programmatically create Google Forms. You can do it with Google Apps Script using its Forms service. You can also extend the code to read in the contents from Google Docs (with Apps Script's Document service) and use it for the creation of Google Forms.
I created a Google Workspace (formerly G Suite) Add-on, which you can think of as a Google Docs extension, called GFormIt. Its original purpose was intended for teachers to write exams/quizzes, possibly with answers, in Google Docs, then automatically convert them to Google Forms to distribute to students who submit their answers into Google Sheets (the destination for Google Forms submissions).
Furthermore, if you (the teacher) provided answers to your test questions, GFormIt would also auto-submit your answers to the Sheet as if you were a student. If you do that, and use a tool like Flubaroo to grade the exam, you could designate your row in the Sheet as “the answer key.” You can learn more about how it works, including viewing a short video, at the GFormIt page linked above.
This Google Docs add-on, along with others for Google Docs, Sheets, Slides, Forms, etc., are all certified/validated by Google and available for free to anyone from the Google Workspace Marketplace. (However, your admins may have to grant permissions for you to try to install them to your corporate Workspace account.) If interested in building your own add-on, please see the developer documentation and perhaps some of my introductory videos to get started, the most relevant being the one linked to at the top of this answer.
Apps Script is a serverless Google technology, meaning you write your code (using JavaScript) in the browser, and it is hosted by & executed on Google servers. If you wanted to create your own web app (and hosted anywhere), you would have to wait for a Google Forms REST API which does not exist at the time of this writing. (If we ever launch one, you'll find its documentation at https://developers.google.com/forms along with the others like Sheets https://developers.google.com/sheets, Gmail https://developers.google.com/gmail, Drive https://developers.google.com/drive, etc.)
Earlier this year (Mar 2022) the new Google Forms Api graduated from Beta. It is more powerful that the previous versions and caters for two main use cases:
Automated form creation and editing: Enables automated form creation
and editing. Enables rapid form generation from large volume question
banks or other data backends.
Reaction to Form responses: The API also enables developers to build
automations for acting on incoming responses. Examples include
developing real-time dashboards or visualizations and triggering
business workflows based on response data.
We have used it to build an integration that Creates documents and slides each time a form is completed: www.portant.co/google-forms-to-docs and it works really well.
I think the other key use case looks like it would be a good fit for you and others looking for a solution like this.
Cheers, James
Sorry, the API doesn't support programmatically creating forms.

Alternative to the deprecated google REST web search API

I have been using the Google Websearch API for over 1 year now. The service was deprecated in Nov 2010 but continues to provide results to date. More recently, google has started to enforce the 1,000 queries (?) per day limit on this deprecated service. I swear, last month I made over 10,000 API calls in one day without any errors from the service (same IP, same API key).
So I guess my question is has anyone found an alternative yet? I know yahoo boss is pretty good but I am working exclusively on Google for my projects. I do not mind spending money for for this service either as long as i can get 64 results from Google.
On that thought, how are services like Zoomrank able to bypass all Google limits? I have a subscription with Zoomrank and I can get daily rankings for all my keywords. Do they have a tie-up with Google or are they just accessing some secret service I don't know about.
Some people have suggested the new Google custom search, but i dont know how does that help me search the web? Google CS is limited to the CSE you create and searches within those engines. If I am looking for web results for Pizza, Google CS doesnt help me.
Thanks for your input. Much appreciated
UPDATE: #ggez44 points to some official Google documentation of the solution described below here: http://support.google.com/customsearch/bin/answer.py?hl=en&answer=1210656
You can use the Google Custom Search Engine to search the entire web.
In brief:
Create a CSE that searches a single site (e.g. google.com)
In the CSE control panel's Basics section, set to "Search the entire web but emphasize certain sites"
In the Sites section, delete the single site that you added when you created the CSE
Full details here:
http://www.google.com/support/forum/p/customsearch/thread?tid=56c0bd92dda351b7&hl=en&fid=56c0bd92dda351b7000495e3f500d83f
Once that's implemented, you can enable billing in the Google API Console at a CPM of $5, to a total of 10,000 queries.
Google API Console: https://code.google.com/apis/console/
Pricing: https://code.google.com/apis/customsearch/v1/overview.html#Pricing

How do you create a document in Google Docs programmatically?

The documentation for Google Documents List API, seems to say that you can create a local document and upload it. Is there no way to actually create and edit a document on Google Docs through an API?
While the docs call it "uploading", everything boils down to sending an appropriately formatted HTTP POST request, so of course it can actually be a new creation rather than an actual "upload" of an otherwise existing file. (Creation through POST requests is similar to what's normally described as a REST API, though in real REST you'd typically use a PUT request instead of course).
You just need to create a blob of data representing your document in any of the formats listed here -- depending on your programming language, simplest may be text/csv for a spreadsheet and application/rtf for a text-document -- then put in in an appropriately formatted POST data. For example, to make a spreadsheet in the simplest way (no metadata), you could POST something like:
POST /feeds/default/private/full HTTP/1.1
Host: docs.google.com
GData-Version: 3.0
Authorization: <your authorization header here>
Content-Length: 81047
Content-Type: text/csv
Slug: Example Spreadsheet
ColumnA, ColumnB
23, 45
Each specific programming language for which a dedicated API is supplied may offer help with this not-so-hard task; for example, in Python, per the docs, the API recommends using ETags to avoid overwriting changes when multiple clients are simultaneously "uploading" (i.e., creating or updating docs). But preparing the POST directly is always possible, since the almost-REST API is documented as the protocol underlying all language-specific APIs.
Alex's answer, while undoubtedly correct, begs the question: "how do I do that via the Google Docs API?"
Here's a way (in Python, 'cause I'm that kind of guy):
import gdata.docs.service
import StringIO
client = gdata.docs.service.DocsService()
client.ClientLogin(username, password,
source='Spreadsheet Creation Example')
content = 'COL_A, COL_B, COL_C, COL_D\ndata1, data2, data3, data4'
ms = gdata.MediaSource(file_handle=StringIO.StringIO(content),
content_type='text/csv',
content_length=len(content))
entry = client.Upload(ms, 'Test Spreadsheet')
This is a small mashup of techniques that I found in http://code.google.com/p/gdata-python-client/source/browse/tests/gdata_tests/docs/service_test.py , which I in turn found via this post from the Google Group for the GData Docs API.
The key insights (for me anyway) were:
realizing that the MediaSource constructor's formal parameter "file_handle" will take any file-like object, and
discovering (as the OP's followup to the Google Group post mentions) that the unit tests are a great source of examples
(I wasn't able to find the Python-specific developer's guide referenced by Alex's doc link -- possibly it's been lost or buried in Google's move of documentation assets from code.google.com to developers.google.com. Alex's link now redirects to the more generic document that shows mostly .NET and Java examples, but only a little Python.)
As of Feb 4, 2019, Google Docs now has a REST API.
See documentation:
https://developers.google.com/docs/api/
(Sep 2019) There are 3 ways to create a document in Google Docs programmatically:
Google Docs REST API (low-level; Python, JS/Node.js, Java, C#/.NET, PHP, Ruby, Go, etc.)
Google Apps Script (high-level; JavaScript-only)
Google Drive API (low-level like Docs API above; both alternatives above can create or edit documents, but this one is create- or delete-only plus editing sharing/permissions)
The Docs API was officially launched in Feb 2019. I produced a high-level video overview of what a mail merge application using the API would look like. (It's not a full-fledged G Suite Dev Show episode but does link to a working sample.) Check out the various guides on using the API, including Quickstart examples in a variety of programming languages.
OTOH, Apps Script is a simpler, higher-level alternative. It's a custom server-side JavaScript runtime supporting apps that are hosted+executed in Google's cloud. Use objects to talk to various Google APIs (G Suite & beyond) without knowledge of HTTP, REST, nor OAuth2. You can also access external databases with its JDBC Service or call other apps via its URL Fetch Service.
With Apps Script, you can create standalone applications, document-bound applications (only works for a single document), or Google Docs Add-ons to extend the functionality of Google Docs. Here are the Google Docs Apps Script overview page as well as the Apps Script reference documentation for Google Docs (Document Service). I've also produced a variety of Apps Script videos if that's your preferred learning vehicle. If you're new to Apps Script, see my answer to a similar SO question for more learning resources.
Typically the Docs, Sheets, Slides, etc., APIs are used to perform document-oriented functionality while the Drive API is used primarily for file-based operations. However "create" is a special case where you can use either. See my answer to another SO question which shows the difference b/w creating a new Google Sheet via the Sheets API vs. the Drive API. (Both samples in Python.) Read this if you're interested in managing sharing or updating permissions of Google Docs.