Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8603391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:18:43+00:00 2026-06-12T02:18:43+00:00

I am looking for a simple example of accessing the Amazon Mechanical Turk web

  • 0

I am looking for a simple example of accessing the Amazon Mechanical Turk web service in C#. I know there is a SDK for C# but I want to understand the basic mechanics before using that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:18:44+00:00Added an answer on June 12, 2026 at 2:18 am

    Here is the simplest code example I’ve come up with to access Mechanical Turk. It creates the signature and calls the GetAccountBalance operation.

    using System;
    using System.Globalization;
    using System.IO;
    using System.Net;
    using System.Security.Cryptography;
    using System.Text;
    
    namespace TurkTest {
        class Program {
    
            static void Main(string[] args) {
                const string SERVICE_NAME = "AWSMechanicalTurkRequester";  // requester service for MTurk
                const string TIMESTAMP_FORMAT = "yyyy-MM-ddTHH:mm:ss.fffZ";
    
                // Modify these with your values.
                const string operation = "GetAccountBalance";
                const string accessKey = "<Your access key>";
                const string secretAccessKey = "<Your secret access key>";
    
                // Millisecond values in the timestamp string can result in intermittent BadClaimsSupplied errors.
                // Get the current UTC time and use that to create a new time with milliseconds set to zero to avoid this case.
                DateTime now = DateTime.UtcNow;
                now = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, 0, DateTimeKind.Utc);
                string timeStamp = now.ToString(TIMESTAMP_FORMAT, CultureInfo.InvariantCulture);
    
                // Create the hash-based messaged authentication algorithm (SHA1) using our secret access key as the key.
                var hmac = new HMACSHA1(Encoding.UTF8.GetBytes(secretAccessKey));
    
                // Combine the service name, operation and timestamp and then hash them to produce the signature.
                var dataBytes = Encoding.UTF8.GetBytes(SERVICE_NAME + operation + timeStamp);
                string signature = Convert.ToBase64String(hmac.ComputeHash(dataBytes));
    
                // Build the URL to send to Amazon
                string url =
                    @"https://mechanicalturk.amazonaws.com/?Service=AWSMechanicalTurkRequester&AWSAccessKeyId={0}&Version=2012-03-25&Operation={1}&Signature={2}&Timestamp={3}";
                url = string.Format(url, accessKey, operation, signature, timeStamp);
    
                // Send a request and write the response to the console.
                using (WebClient client = new WebClient()) {
                    using (StreamReader reader = new StreamReader(client.OpenRead(url))) {
                        Console.WriteLine(reader.ReadToEnd());
                    }
                }
    
                Console.Read();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've searched this site and the web and just looking for a simple example
I am looking for simple example for workflow 4.0 exposed as WCF service and
I am looking for a very simple example where e.g. there is a two
I'm looking for a simple example of the Worley algorithm. From what I understand
I'm new to using EWS (Exchange Web Service) and I'm looking for a simple
I am looking for simple example code for setting up a Message in an
I'm looking for a dead simple example on how to use aggregate and calculate
I've been looking all over for a simple example of how to have an
Ok, this is an embarassingly simple-looking problem, but is driving me crazy. I'm learning
I saw this question Simple example of threading in C++ but my problem is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.