Skip to content

Instantly share code, notes, and snippets.

@brianmfear
Created April 16, 2020 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianmfear/dfc90371ea3bf8385581c8b37df3449a to your computer and use it in GitHub Desktop.
Save brianmfear/dfc90371ea3bf8385581c8b37df3449a to your computer and use it in GitHub Desktop.
public class AWSTranscribeExample extends AWS {
public override void init() {
endpoint = new Url('https://transcribe.us-west-2.amazonaws.com/');
resource = '/';
region = 'us-west-2';
service = 'transcribe';
accessKey = 'my-key-here';
method = HttpMethod.XPOST;
payload = Blob.valueOf('{"LanguageCode": "en-US","Media": {"MediaFileUri": "S3 audio file link"},"MediaFormat": "mp4","MediaSampleRateHertz": 44100,"TranscriptionJobName": "SampleRestJob7"}');
setHeader('x-amz-target','Transcribe.StartTranscriptionJob');
setHeader('content-type', 'application/x-amz-json-1.1');
createSigningKey('my-secret-key-here');
}
public String executeCallout() {
return sendRequest().getBody();
}
}
// See https://gist.github.com/brianmfear/92cf05807ac4becbd21f for AWS
@kalikotaa
Copy link

@brianmfear I'm getting below error when trying this code
<Error><Code>MalformedXML</Code><Message>The XML you provided was not well-formed or did not validate against our published schema</Message><RequestId>XXXXXX</RequestId><HostId>XXXX+XXXX=</HostId></Error>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment