Microsoft Edge 加载项的 REST API 参考

本文是 Microsoft Edge 加载项 API 的 REST 终结点参考。 此 API 自动发布已提交到 Microsoft Edge 加载项存储的加载项的更新。

有关概述,请参阅 使用 Microsoft Edge 加载项 REST API

上传包以更新现有提交

上传包以更新附加产品的现有草稿提交。

请求

方法 请求 URI
POST /products/{productID}/submissions/draft/package
URI 参数
URI 参数 说明
productID 必填。 必须将包上传到的产品的产品 ID。
请求标头
  • 必需。 Authorization: Bearer <auth token>

  • 必需。 Content-Type: application/zip

请求正文
  • <Zip package>

响应

响应标头
  • 位置: {operationID}
状态代码

此 API 具有以下预期状态代码。

HTTP 状态代码 说明
202 请求已接受处理,但处理未完成。
4XX 请参阅 错误代码
5XX 请参阅 错误代码

另请参阅:

检查包上传的状态

获取包上传的状态。

请求

方法 请求 URI
GET /products/{productID}/submissions/draft/package/operations/{operationID}
URI 参数
URI 参数 说明
operationID 必需。 在上一步中提交的上传请求的操作 ID。 此信息在响应标头中可用。
请求标头
  • 必填。 Authorization: Bearer <auth token>
请求正文

无。

响应

对于不同的方案,有多种响应。

操作仍在进行中的响应
{
    "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 加载项。

请求

方法 请求 URI
POST /products/{productID}/submissions
URI 参数
URI 参数 说明
productID 必需。 必须发布草稿的产品的产品 ID。
请求标头
  • 必需。 Authorization: Bearer <auth token>
请求正文

<Notes for certification>,采用纯文本格式。

响应

响应标头
  • 位置: {operationID}
状态代码

此 API 具有以下预期状态代码。

HTTP 状态代码 说明
202 请求已接受处理,但处理未完成。
4XX 请参阅 错误代码
5XX 请参阅 错误代码

另请参阅:

检查发布状态

检查发布操作的状态。

请求

方法 请求 URI
GET /products/{productID}/submissions/operations/{operationID}
URI 参数

无。

请求标头
  • 必需。 Authorization: Bearer <auth token>
请求正文

无。

响应

GET在以下方案中,可以调用操作状态 API。 在所有有效方案中, 200 OK 返回具有不同状态消息的 。

发布新产品时的响应
{
    "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 错误请求 服务器不理解请求。 正文中没有包 (zip 文件) 。 或者, Content-Type 标头缺失或其值不正确。
401 未授权 请求页需要授权。 身份验证令牌缺失、过期或无效。
404 未找到 服务器找不到请求的页面。 指定的 productIDoperationID 没有有效的 GUID、无效或不属于发出请求的开发人员。
408 请求超时 请求花费的时间比服务器准备等待的时间长。 上传包时超时。
429 请求过多 用户发送的请求过多。 发送的请求过多,它们受到限制。

5xx:服务器错误

邮件 说明 示例方案
500 内部服务器错误 请求未完成。 服务器遇到意外情况。

另请参阅