共用方式為


Microsoft Edge Add-ons 擴充功能的 REST API 參考

本文為 Microsoft Edge Add-ons API 的 REST 端點參考資料。 這個 API 自動化將更新發佈到 Microsoft Edge Add-ons 的擴充套件。

欲了解概覽,請參閱 Microsoft Edge Add-ons 中的「使用 REST API 更新擴充功能」。

Update REST API 的版本

自 2024 年 9 月 6 日起,支援此更新 REST API 的 v1.1 與 v1。 v1 的支援將於 2024 年 12 月 31 日結束。

上傳套件以更新現有的提交

上傳套件以更新現有的延長提案草稿。

另見 Microsoft Edge Add-ons 中上傳套件以更新現有提交」,即使用 REST API 更新擴充功能。

方法 請求 URI
POST /products/$productID/submissions/draft/package
URI 參數
URI 參數 描述
$productID 此為必要動作。 必須上傳包裹的產品 ID。
要求標頭

以下請求標頭是必需的:

  • Authorization: ApiKey $ApiKey
  • X-ClientID: $ClientID
  • Content-Type: application/zip
要求內文
  • <Zip package>

回應

回應標頭
  • 位置: {operationID}

回應包含一個操作 ID,用於傳送至其他端點。

狀態碼

此 API 有以下預期狀態碼。

HTTP 狀態碼 描述
202 申請已被接受處理,但處理尚未完成。
4XX 詳見下方 的錯誤代碼
5XX 詳見下方 的錯誤代碼

另請參閱:

  • 上傳套件以更新Microsoft Edge Add-ons 中的現有提交,使用 REST API 來更新擴充功能

檢查包裹上傳的狀態

會收到包裹上傳的狀態。

另見 Microsoft Edge 附加元件中「使用 REST API 更新擴充套件」中的「檢查套件上傳狀態」。

方法 請求 URI
GET /products/$productID/submissions/draft/package/operations/$operationID
URI 參數
URI 參數 描述
$operationID 此為必要動作。 上一步提交的上傳請求的操作 ID。 這些資訊可在回應標頭中找到。
要求標頭

以下請求標頭是必需的:

  • Authorization: ApiKey $ApiKey
  • X-ClientID: $ClientID
要求內文

無。

回應

針對不同情境,有多種回應方式。

手術仍在進行時的應對
{
    "id": "{operationID}",
    "createdTime": "Date Time",
    "lastUpdatedTime": "Date Time",
    "status": "InProgress",
    "message": null,
    "errorCode": null,
    "errors": null
}
行動成功時的反應
{
    "id": "{operationID}",
    "createdTime": "Date Time",
    "lastUpdatedTime": "Date Time",
    "status": "Succeeded",
    "message": "Successfully updated package to {fileName}.zip",
    "errorCode": "",
    "errors": null
}
操作失敗時的回應(錯誤)
{
    "id": "{operationID}",
    "createdTime": "Date Time",
    "lastUpdatedTime": "Date Time",
    "status": "Failed",
    "message": "Error Message.",
    "errorCode": "Error Code",
    "errors": ["list of errors"]
}
回應標頭

無。

狀態碼

此 API 有以下預期狀態碼。

HTTP 狀態碼 描述
200 這個請求是可以的。
4XX 詳見下方 的錯誤代碼
5XX 詳見下方 的錯誤代碼

另請參閱:

發布產品草案提交

Microsoft Edge Add-ons 發布產品的最新草案。

另見 Microsoft Edge Add-ons 中「使用 REST API 更新擴充套件」中的發佈提交

方法 請求 URI
POST /products/$productID/submissions
URI 參數
URI 參數 描述
$productID 此為必要動作。 必須發表草稿的產品 ID。
要求標頭

以下請求標頭是必需的:

  • Authorization: ApiKey $ApiKey
  • X-ClientID: $ClientID
要求內文

<Notes for certification>,以純文字格式呈現。

回應

回應標頭
  • 位置: {operationID}

回應包含一個操作 ID,用於傳送至其他端點。

狀態碼

此 API 有以下預期狀態碼。

HTTP 狀態碼 描述
202 申請已被接受處理,但處理尚未完成。
4XX 詳見下方 的錯誤代碼
5XX 詳見下方 的錯誤代碼

另請參閱:

  • Microsoft Edge Add-ons 使用 REST API 更新擴充功能發佈提交

請查看出版狀態

檢查發佈操作的狀態。

另請參閱 Microsoft Edge 附加元件中「使用 REST API 更新擴充功能」中的「檢查發佈狀態」。

方法 請求 URI
GET /products/$productID/submissions/operations/$operationID
URI 參數

無。

要求標頭

以下請求標頭是必需的:

  • Authorization: ApiKey $ApiKey
  • X-ClientID: $ClientID
要求內文

無。

回應

GET在以下情境下,可以呼叫操作狀態 API。 在所有有效情況下, 200 OK 會回傳不同的狀態訊息。

回應包含一個操作 ID,用於傳送至其他端點。

新產品發表時的回應
{
    "id": "{operationID}",
    "createdTime": "Date Time",
    "lastUpdatedTime": " Date Time ",
    "status": "Failed",
    "message": "Can't create new extension.",
    "errorCode": "CreateNotAllowed",
    "errors": null
}
當沒有新內容可發表時的回應
{
    "id": "{operationID}",
    "createdTime": "Date Time",
    "lastUpdatedTime": " Date Time ",
    "status": "Failed",
    "message": "Can't publish extension since there are no updates, please try again after updating the package.",
    "errorCode": "NoModulesUpdated",
    "errors": null
}
當同一產品有評論提交時的回應
{
    "id": "{operationID}",
    "createdTime": "Date Time",
    "lastUpdatedTime": " Date Time ",
    "status": "Failed",
    "message": "Can't publish extension as your extension submission is in progress. Please try again later.",
    "errorCode": "InProgressSubmission",
    "errors": null    
}
當同一產品有持續未發表的投稿時的回應
{
    "id": "{operationID}",
    "createdTime": "Date Time",
    "lastUpdatedTime": " Date Time ",
    "status": "Failed",
    "message": "Can't publish extension as your extension is being unpublished. Please try after you've unpublished.",
    "errorCode": "UnpublishInProgress",
    "errors": null    
}
當任一模組無效時的回應
{
    "id": "{operationID}",
    "createdTime": "Date Time",
    "lastUpdatedTime": " Date Time ",
    "status": "Failed",
    "message": "Can't publish extension as your extension has modules that are not valid. Fix the modules with errors and try to publish again.",
    "errorCode": "ModuleStateUnPublishable",
    "errors": [
        {
            "message": "Invalid module : <Modules>"
        }
    ]
}
提交時的回覆
{
    "id": "{operationID}",
    "createdTime": "Date Time",
    "lastUpdatedTime": " Date Time ",
    "status": "Failed",
    "message": "Extension can't be published as there are submission validation failures. Fix these errors and try again later.",
    "errorCode": "SubmissionValidationError",
    "errors": ["{list of errors}"]
}
發佈呼叫成功時的回應
{
    "id": "{operationID}",
    "createdTime": "Date Time",
    "lastUpdatedTime": "Date Time",
    "status": "Succeeded",
    "message": "Successfully created submission with ID {submission.Id}",
    "errorCode": "",
    "errors": null
}
當發佈呼叫失敗且無法恢復時的回應
{
    "id": "{operationID}",
    "createdTime": "Date Time",
    "lastUpdatedTime": " Date Time ",
    "status": "Failed",
    "message": "An error occurred while performing the operation",
    "errorCode": null,
    "errors": null
}
發佈呼叫失敗時的回應,發生意外失敗
{
    "id": "{operationID}",
    "message": "An error occurred while processing the request. Please contact support Correlation ID: {operationID} Timestamp: {timeStamp}",
}
回應標頭

無。

狀態碼

此 API 有以下預期狀態碼。

HTTP 狀態碼 描述
200 這個請求是可以的。
4XX 詳見下方 的錯誤代碼
5XX 詳見下方 的錯誤代碼

另請參閱:

錯誤碼

以下是常見錯誤代碼及可能原因的清單。 完整清單請參閱 合作夥伴中心 REST 錯誤代碼HTTP 狀態代碼列表

4xx:用戶端錯誤

郵件 描述 案例範例
400 個壞請求 伺服器不理解這個請求。 正文裡沒有套件 (壓縮檔) 。 或者, Content-Type 標頭缺失或其值錯誤。
401 未經授權 請求頁面需要授權。 認證令牌遺失、過期或無效。
404號未找到 伺服器找不到被請求的頁面。 指定的產品 ID 或操作 ID 沒有有效的 GUID、不有效,或不屬於提出請求的開發者。
408 要求逾時 這個請求花的時間比伺服器準備等待的時間還長。 上傳包裹時發生了一次超時。
429 請求太多 使用者發出的請求太多。 請求太多,結果被限速。

5xx:伺服器錯誤

郵件 描述 案例範例
500 內部伺服器錯誤 申請還沒完成。 伺服器遇到了一個意想不到的條件。

另請參閱