-1

I am building a POC using AWS Translate and one of the requirement is to use REST API.

I have constructed the below url :

enter image description here

but when I hit the url using POSTMAN I get the below error :

{
    "__type": "UnknownOperationException"
}
Emmanuel Ban
  • 105
  • 9
aksyuma
  • 2,957
  • 1
  • 15
  • 29

1 Answers1

7

I have managed to find a fix to my issue. The issue was that, I was expecting the "x-amz-target" header to have a friendly name e.g "translate" but from this link, the "x-amz-target" header needs to be "AWSShineFrontendService_20170701.TranslateText"

Solution:

  1. In postman, I created a new POST request.

  2. I then changed the URL specific to an AWS Translate region from:

    https://translate.us-east-1.amazonaws.com/TranslateText
    

to :

    https://translate.us-east-1.amazonaws.com/
  1. Under "Headers" I added the following headers:

    Content-Type: application/x-amz-json-1.1
    X-Amz-Target: AWSShineFrontendService_20170701.TranslateText

  2. Under "Body", I selected "raw", and added the following sample body:

    {
      "SourceLanguageCode": "en",
      "TargetLanguageCode": "fr",
      "Text": "Creating a test terminology in AWS Translate"
    }
    

After testing again I got it working, as you can see in the screenshot below :

AWS_Translate_POSTMAN

aksyuma
  • 2,957
  • 1
  • 15
  • 29
  • 1
    Link above is dead; AWS has same info here: https://docs.aws.amazon.com/translate/latest/dg/examples-sigv4.html , eg: # POST requests use a content type header. For Amazon Translate, # the content is JSON. content_type = 'application/x-amz-json-1.1' amz_target = 'AWSShineFrontendService_20170701.TranslateText' – James Daily May 04 '23 at 15:11
  • 1
    I'll update dead like shortly ... – aksyuma May 04 '23 at 16:27