get_model_presigned_url

MachineLearningApi.get_model_presigned_url(role_id, model_pre_signed, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Generate a PUT URL for an ML model artifact

Returns a presigned PUT URL and uploadPath in the ML temp bucket under ml-models/{uuid}/{FileName}. Use uploadPath as ArtifactsLocation when creating a custom model.

Parameters:
  • role_id (str) – Role identifier used for authorization. Missing this header returns AUTH-1001. (required)

  • model_pre_signed (ModelPreSigned) – (required)

  • content_type (str)

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

ModelPreSignedResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /models/getPresignedUrl

Request

Request / response example

{
  "FileName": "sampleFile.gz"
}

Success (HTTP 200)

Presigned PUT URL and the S3 uploadPath to use as ArtifactsLocation on POST /models.

Request / response example

{
  "presignedUrl": "https://example-ml-temp.s3.amazonaws.com/ml-models/7f3a2c1e-9b44-4d21-8c0a-1a2b3c4d5e6f/sampleFile.gz",
  "uploadPath": "s3://example-ml-temp/ml-models/7f3a2c1e-9b44-4d21-8c0a-1a2b3c4d5e6f/sampleFile.gz"
}

Errors

Documented error codes: IPV-1001, GE-1044.

HTTP 400

FileName is empty (IPV-1001) or the caller lacks mlmodels.fullaccess.

Request / response example

{
  "Message": "IPV-1001 - Parameter FileName is a required value."
}

HTTP 500

Unexpected failure generating the URL (GE-1044), including a missing FileName key.

Request / response example

{
  "Message": "GE-1044 - Unexpected error - 'FileName'."
}