This example illustrates one usage of GetBatchPrediction.
Sample Request
POST / HTTP/1.1
Host: machinelearning.<region>.<domain>
x-amz-Date: <Date>
Authorization: AWS4-HMAC-SHA256 Credential=<Credential>,
SignedHeaders=contenttype;date;host;user-agent;x-amz-date;x-amz-target;x-amzn-requestid,Signature=<Signature>
User-Agent: <UserAgentString>
Content-Type: application/x-amz-json-1.1 Content-Length: <PayloadSizeBytes>
Connection: Keep-Alive
X-Amz-Target: AmazonML_20141212.GetBatchPrediction
{"BatchPredictionId": "EXAMPLE-bp-2014-09-12-15-14-04-156"}
See Also
Sample Response
HTTP/1.1 200 OK
x-amzn-RequestId: <RequestId>
Content-Type: application/x-amz-json-1.1 Content-Length: <PayloadSizeBytes>
Date: <Date>
{ "BatchPredictionDataSourceId":"EXAMPLE-tr-ds-2014-09-12-15-14-04-989", "BatchPredictionId":"EXAMPLE-bp-2014-09-12-15-14-04-156",
"CreatedAt":1410560632.327,
"CreatedByIamUser":"arn:aws:iam::<awsAccountId>:user/user", "InputDataLocationS3": "s3://eml-test-EXAMPLE/example.csv", "LastUpdatedAt":1410560632.327,
"LogUri": "https://s3bucket/locationToLogs/logname.tar.gz", "Name":"EXAMPLE",
"OutputUri":"s3://eml-test-EXAMPLE/test-outputs/EXAMPLE-bp-2014-09-12-15-14-04-156/
results",
"MLModelId":"EXAMPLE-pr-2014-09-12-15-14-04-924", "Status":"COMPLETED",
"ComputeTime":"185200", "FinishedAt":1410560632.327, "StartedAt":1410560632.327, "TotalRecordCount":"21154", "InvalidRecordCount":"0"
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
• AWS Command Line Interface
• AWS SDK for .NET
• AWS SDK for C++
• AWS SDK for Go
• AWS SDK for Java V2
• AWS SDK for JavaScript
• AWS SDK for PHP V3
• AWS SDK for Python
• AWS SDK for Ruby V3
GetDataSource
GetDataSource
Returns a DataSource that includes metadata and data file information, as well as the current status of the DataSource.
GetDataSource provides results in normal or verbose format. The verbose format adds the schema description and the list of files pointed to by the DataSource to the normal format.
Request Syntax
{
"DataSourceId": "string", "Verbose": boolean }
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters (p. 159).
The request accepts the following data in JSON format.
DataSourceId (p. 87)
The ID assigned to the DataSource at creation.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern: [a-zA-Z0-9_.-]+
Required: Yes Verbose (p. 87)
Specifies whether the GetDataSource operation should return DataSourceSchema.
If true, DataSourceSchema is returned.
If false, DataSourceSchema is not returned.
Type: Boolean Required: No
Response Syntax
{
"ComputeStatistics": boolean, "ComputeTime": number, "CreatedAt": number,
"CreatedByIamUser": "string", "DataLocationS3": "string", "DataRearrangement": "string", "DataSizeInBytes": number,
Response Elements
"DataSourceId": "string", "DataSourceSchema": "string", "FinishedAt": number,
"LastUpdatedAt": number, "LogUri": "string", "Message": "string", "Name": "string", "NumberOfFiles": number, "RDSMetadata": { "Database": {
"DatabaseName": "string", "InstanceIdentifier": "string"
},
"DatabaseUserName": "string", "DataPipelineId": "string", "ResourceRole": "string", "SelectSqlQuery": "string", "ServiceRole": "string"
},
"RedshiftMetadata": {
"DatabaseUserName": "string", "RedshiftDatabase": {
"ClusterIdentifier": "string", "DatabaseName": "string"
},
"SelectSqlQuery": "string"
},
"RoleARN": "string", "StartedAt": number, "Status": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
ComputeStatistics (p. 87)
The parameter is true if statistics need to be generated from the observation data.
Type: Boolean ComputeTime (p. 87)
The approximate CPU time in milliseconds that Amazon Machine Learning spent processing the DataSource, normalized and scaled on computation resources. ComputeTime is only available if the DataSource is in the COMPLETED state and the ComputeStatistics is set to true.
Type: Long CreatedAt (p. 87)
The time that the DataSource was created. The time is expressed in epoch time.
Type: Timestamp CreatedByIamUser (p. 87)
The AWS user account from which the DataSource was created. The account type can be either an AWS root account or an AWS Identity and Access Management (IAM) user account.
Type: String
Response Elements
Pattern: arn:aws:iam::[0-9]+:((user/.+)|(root)) DataLocationS3 (p. 87)
The location of the data file or directory in Amazon Simple Storage Service (Amazon S3).
Type: String
Length Constraints: Maximum length of 2048.
Pattern: s3://([^/]+)(/.*)?
DataRearrangement (p. 87)
A JSON string that represents the splitting and rearrangement requirement used when this DataSource was created.
Type: String DataSizeInBytes (p. 87)
The total size of observations in the data files.
Type: Long DataSourceId (p. 87)
The ID assigned to the DataSource at creation. This value should be identical to the value of the DataSourceId in the request.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern: [a-zA-Z0-9_.-]+
DataSourceSchema (p. 87)
The schema used by all of the data files of this DataSource.
Note: This parameter is provided as part of the verbose format.
Type: String
Length Constraints: Maximum length of 131071.
FinishedAt (p. 87)
The epoch time when Amazon Machine Learning marked the DataSource as COMPLETED or
FAILED. FinishedAt is only available when the DataSource is in the COMPLETED or FAILED state.
Type: Timestamp LastUpdatedAt (p. 87)
The time of the most recent edit to the DataSource. The time is expressed in epoch time.
Type: Timestamp LogUri (p. 87)
A link to the file containing logs of CreateDataSourceFrom* operations.
Type: String Message (p. 87)
The user-supplied description of the most recent details about creating the DataSource.
Errors
Type: String
Length Constraints: Maximum length of 10240.
Name (p. 87)
A user-supplied name or description of the DataSource.
Type: String
Length Constraints: Maximum length of 1024.
Pattern: .*\S.*|^$
NumberOfFiles (p. 87)
The number of data files referenced by the DataSource.
Type: Long RDSMetadata (p. 87)
The datasource details that are specific to Amazon RDS.
Type: RDSMetadata (p. 144) object RedshiftMetadata (p. 87)
Describes the DataSource details specific to Amazon Redshift.
Type: RedshiftMetadata (p. 154) object RoleARN (p. 87)
The Amazon Resource Name (ARN) of an AWS IAM Role, such as the following:
arn:aws:iam::account:role/rolename.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 110.
StartedAt (p. 87)
The epoch time when Amazon Machine Learning marked the DataSource as INPROGRESS.
StartedAt isn't available if the DataSource is in the PENDING state.
Type: Timestamp Status (p. 87)
The current status of the DataSource. This element can have one of the following values:
• PENDING - Amazon ML submitted a request to create a DataSource.
• INPROGRESS - The creation process is underway.
• FAILED - The request to create a DataSource did not run to completion. It is not usable.
• COMPLETED - The creation process completed successfully.
• DELETED - The DataSource is marked as deleted. It is not usable.
Type: String
Valid Values: PENDING | INPROGRESS | FAILED | COMPLETED | DELETED
Errors
For information about the errors that are common to all actions, see Common Errors (p. 161).
Examples
InternalServerException
An error on the server occurred when trying to process a request.
HTTP Status Code: 500 InvalidInputException
An error on the client occurred. Typically, the cause is an invalid input value.
HTTP Status Code: 400 ResourceNotFoundException
A specified resource cannot be located.
HTTP Status Code: 400