

已重組 AWS Marketplace API 參考。如需支援的 API 操作的詳細資訊，請參閱 [AWS Marketplace API 參考](https://docs.aws.amazon.com/marketplace/latest/APIReference/Welcome.html)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 新增新版本
<a name="ml-add-version"></a>

您可以使用目錄 API 或 AWS Marketplace 管理入口網站，將新版本新增至機器學習產品。如需使用入口網站的詳細資訊，請參閱《*AWS Marketplace 賣方指南*》中的[新增版本](https://docs.aws.amazon.com/marketplace/latest/userguide/machine-learning-products.html)。

**注意**  
對於 ML 產品，版本包含單一交付選項，代表您要提供的產品。在目錄 API 中，使用 ML 產品的交付選項可有效修改產品的版本。  
新增執行個體類型時，請在`UpdatePricingTerms`變更集中包含變更類型，以指定新執行個體類型的定價。對於新產品， `UpdatePricingTerms` 必須涵蓋所有支援的執行個體類型。ML 產品`UpdatePricingDimensions`不需要或不支援 ，因為所有支援的執行個體類型都會自動產生維度。如需詳細資訊，請參閱 [更新定價維度](work-with-seller-products.md#update-dimensions)。

**使用 `StartChangeSet`來新增版本**

 若要新增新版本，請使用`AddDeliveryOptions`變更類型呼叫 `StartChangeSet`操作：

1.  若要在不建立版本的情況下驗證您的 API 呼叫，請將 `Intent`設定為 `VALIDATE`。

1.  對於實際版本建立，請將 `Intent`設定為 `APPLY`。

## 請求語法
<a name="request-syntax"></a>

```
POST /StartChangeSet HTTP/1.1
Content-type: application/json
{
    "Catalog": "AWSMarketplace",
    "ChangeSet": [{
        "ChangeType": "AddDeliveryOptions",
        "Entity": {
            "Identifier": "example1-abcd-1234-5ef6-7890abcdef12@1",
            "Type": "MachineLearningProduct@1.0"
        },
        "DetailsDocument": {
            "Version": {
                "VersionTitle": "version 1.1",
                "ReleaseNotes": "Patch update for small bugfix in version 1.0"
            },
            "DeliveryOptions": [{
                "Details": {
                    "SageMakerAlgorithmDeliveryOptionDetails": {
                       "SageMakerAlgorithmArn": "arn:aws:sagemaker:us-east-2:605142612156:algorithm/scikit-decision-trees-1552343220",
                       "AccessRoleArn": "arn:aws:iam::12345678901:role/AwsMarketplaceSageMakerIngestion",
                        "UsageInstructions":"This is how you use your algorithm", 
                       "SampleNotebookUrl": "https://www.amazon.com",
                        "RepositoryUrl": "https://www,amazon.com",
                        "InputProperties": {
                            "Description": "Input should have all columns in the train/test file except for 'is_fraud' column.",
                            "Limitations": "Can predict on 1 input in the CSV only at a time",
                           "SampleInput": {
                                "RealtimeInferenceText": "{\"prompt\":\"Write summary\",
                                                            \"maxTokens\": 1 }",
                                "BatchTransformUrl": "https://www.sampleData.com",
                            },
                           "Parameters": [{
                                    "Name": "prompt",
                                    "Description": "Represents the instruct-style prompt for the model. DataType is String",
                                    "Constraints": "Minimum length should be 1",
                                    "Required": true
                                },
                                {
                                    "Name": "maxTokens",
                                    "Description": "Denotes the number of tokens to predict per generation. See BPE Tokens for more details.",
                                    "Constraints": "Minvalue: 1, MaxValue: 30"
                                }
                            ],
                            "SageMakerCustomAttributes": [{
                                    "Name": "threshold",
                                    "Description": "Threshold of the confidence score of the detected object",
                                    "Constraints": "Should be an Integer"
                            }]
                    },
                    "OutputProperties": {
                        "Description": "The output is a JSON object that has the generated text along with likelihoods of tokens, if requested. See example json.",
                       "SampleOutput": {
                            "RealtimeInferenceUrl": "https://www.sampledata.com",
                            "BatchTransformUrl": "https://www.sampleData.com",
                        },
                       "Parameters": [{
                                "Name": "id",
                                "Description": "An identifier for response"
                                "AlwaysReturned": true
                            },
                            {
                                "Name": "generations",
                                "Description": "The generated text along with the likelihoods for tokens requested.",
                            }
                        ],
                    },
                   "RecommendedInstanceTypes": {
                        "BatchTransform": "ml.m4.large",
                        "RealtimeInference": "ml.m4.large",
                        "Training": "ml.m4.large"
                   }
                }
            }]
        }
    }],
    "Intent": "APPLY"
}
```

## 必要欄位
<a name="add-version-required-fields"></a>
+  `Entity` （物件）—必要 

  包含 ML 產品的相關資訊。
  +  `Identifier` （字串）—必要 

    您的產品 ID。如需詳細資訊，請參閱[識別符](https://docs.aws.amazon.com/marketplace/latest/APIReference/catalog-apis.html#identifier)。
  +  `Type` （字串）—必要 

    指定交付方法 （產品類型）。它必須是 `MachineLearningProduct@1.0`。
+ `DetailsDocument` （物件）—必要

  包含您產品新版本的所有詳細資訊。
  + `Version` （物件）—必要

    有關要新增之版本的詳細資訊。
    + `VersionTitle` （字串）—必要

      版本的標題，例如「1.1 版」或「1.1」。買方會從這些標題選取版本。
    + `ReleaseNotes` （字串）—必要

      有關此版本的詳細備註。必須少於 30，000 個字元。
  + `DeliveryOptions` （陣列）—必要

    產品版本的交付方法陣列。每個版本僅限一個交付選項。
    + `Details` （物件）—必要
      + `SagemakerModelPackageDeliveryOptionDetails` 或 `SageMakerAlgorithmDeliveryOptionDetails`（物件）
        + `SageMakerModelPackageArn` 或 `SageMakerAlgorithmArn`（字串） - 必要

          模型套件或演算法的 Amazon Resource Name (ARN)。
        + `AccessRoleArn` （字串）—必要 

          AWS Marketplace 存取 SageMaker 資源的 IAM 角色 ARN。
        + `SampleNotebookUrl` （字串）—必要 

          連結至使用代碼的範例 Jupyter 筆記本。如需詳細資訊，請參閱 GitHub 上的[範例筆記本範本](https://github.com/aws/amazon-sagemaker-examples/blob/master/aws_marketplace/curating_aws_marketplace_listing_and_sample_notebook/ModelPackage/Sample_Notebook_Template/title_of_your_product-Model.ipynb)。
        + `RepositoryUrl` （字串）—必要 

          筆記本和範例資料存取的 Git 儲存庫 URL。如需詳細資訊，請參閱 [GitHub 上的範例 Git 儲存庫](https://github.com/aws/amazon-sagemaker-examples/tree/master/aws_marketplace/curating_aws_marketplace_listing_and_sample_notebook/ModelPackage/Sample_Notebook_Template)。 GitHub 
        + `UsageInstructions` （字串）—必要 

          演算法的訓練資訊或模型的使用詳細資訊。
        + `InputProperties` （物件）—必要
          + `Description` （字串）—必要 

            模型/演算法輸入的描述
          + `Limitations` (string) 

            輸入限制
          + `SampleInput` （物件）—必要

            RealtimeInferenceUrl （字串） \| RealtimeInferenceText （字串） \| BatchTransformUrl （字串） \| BatchTransformText （字串）
          + `Parameters` (Array<Object>)

            名稱 （字串） — 必要 \| 描述 （字串） — 必要 \| 限制 （字串） \| 必要 （布林值）
          + `SageMakerCustomAttributes` (Array<Object>)

            描述模型支援的任何 [CustomAttributes](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html#API_runtime_InvokeEndpoint_RequestParameters)。

            `Name` （字串） — 必要 \| `Description`（字串） — 必要 \| `Constraints`（字串） \| `Required`（布林值）
        + `OutputProperties` （物件）—必要
          + `Description` （字串）—必要
          + `SampleOutput` (Array<Object>)—必要

            RealtimeInferenceUrl （字串） \| RealtimeInferenceText （字串） \| BatchTransformUrl （字串） \| BatchTransformText （字串）
          + `Parameters` （陣列）

            名稱 （字串） — 必要 \| 描述 （字串） — 必要 \| AlwaysReturned （布林值）
        + `RecommendedInstanceTypes` （物件）—必要
          + `BatchTransform` （字串）—必要
          + `RealtimeInference` （字串）—必要
          + `Training` （字串）—僅適用於 SageMaker 演算法

## 回應語法
<a name="response-syntax"></a>

當您提交請求時，會建立變更集，且 API 會傳回：

```
{
  "ChangeSetId": "{{example123456789012abcdef}}",
   "ChangeSetArn": "arn:aws:aws-marketplace:us-east-1:{{123456789012}}:AWSMarketplace/ChangeSet/{{example123456789012abcdef}}"
}
```

**變更集處理**  
變更請求會進入處理佇列，其中會經歷幾個步驟：

1. 驗證：系統會檢查以確保所有資訊都符合 AWS Marketplace 準則。
   +  處理時間：幾分鐘到幾個小時 
   +  如需驗證錯誤，請參閱[變更集狀態和錯誤](https://docs.aws.amazon.com/marketplace/latest/APIReference/work-with-seller-products.html#seller-product-change-set-errors)。

1.  狀態監控：您可以用兩種方式檢查請求的狀態。
   + 透過 AWS Marketplace 管理入口網站
   + 使用 `DescribeChangeSet` 操作

1.  完成：核准時，會新增新版本。

## 錯誤
<a name="errors"></a>

**非同步錯誤**  
 以下是 AWS Marketplace 目錄 API 中`AddDeliveryOptions`動作特有的錯誤。當您在處理變更集`DescribeChangeSet`時呼叫 時，就會出現這些錯誤。如需使用 `DescribeChangeSet` 檢查變更請求狀態的詳細資訊，請參閱[使用變更集](https://docs.aws.amazon.com/marketplace-catalog/latest/api-reference/welcome.html#working-with-change-sets)。




| 錯誤碼 | 錯誤訊息 | 
| --- | --- | 
| INCOMPATIBLE\_PRODUCT\_STATUS | 我們找不到提供的產品。提供有效的產品。 | 
| DUPLICATE\_VERSION\_TITLE | 提供的版本標題已在使用中。建立唯一的版本標題。 | 
| INVALID\_RECOMMENDED\_INSTANCE\_TYPE | 您未提供 【x】 的有效執行個體類型。輸入有效的執行個體類型，然後再試一次。有效類型為：【valids】 | 
| INCOMPATIBLE\_DELIVERY\_OPTIONS | 您提供的交付選項與您先前的選擇不相符：【先前選擇】。更新您的交付選項，然後再試一次。 | 
| INVALID\_ASSET\_ARN | 您未提供 SageMakerAlgorithmDeliveryOption 的有效 ARN。輸入有效的 ARN，然後再試一次。 | 
| DUPLICATE\_ASSET | 您未提供此產品的唯一 ARN。輸入唯一的 ARN，然後再試一次。 | 
| ASSET\_NOT\_FOUND | 我們找不到您提供的 ARN。確認 ARN 正確且具有必要的許可。 | 
| ASSET\_VALIDATION\_EXCEPTION | 無法將 SagemakerModelArn/SagemakerAlgorithmArn 【x】 擷取至 AWS Sagemaker 帳戶 | 
| INVALID\_ACCESS\_ROLE | 我們找不到您提供的 IAM 角色 ARN。驗證 ARN 是否正確，然後再試一次。 | 
| UPDATE\_PRICING\_REQUIRED | UpdatePricingTerms 是必要項目。 | 