Using the Microsoft Edge Add-ons REST API
To publish an extension, you first use Partner Center, and then optionally you can use this REST API to update the extension.
The Microsoft Edge Add-ons API provides a set of REST endpoints for programmatically publishing updates to add-ons submitted to the Microsoft Edge Add-ons store. You can use these REST endpoints to automate the process of uploading and publishing new versions of your add-ons to the Microsoft Edge Add-ons store. You use the Publish API page at Partner Center to enable the API and begin working with these API endpoints.
To submit suggestions and feedback, enter an Issue about the Add-ons API.
Terminology
Term | Definition |
---|---|
operation | A REST operation such as GET or PUT. |
operation ID | The ID of a REST operation. |
package | The .zip package that contains the files for your Microsoft Edge Add-on. |
product | A Microsoft Edge extension or theme. Also referred to as a Microsoft Edge Add-on. |
product ID | The product ID of the product whose draft needs to be published. The product ID is a 128-bit GUID that is associated with a product at Partner Center. For example: d34f98f5-f9b7-42b1-bebb-98707202b21d . |
submission | An update that is being submitted to an existing product at Partner Center. Every update to a product is a submission, regardless of whether the status is In Draft , In Review , or In the Store (published). |
Before you begin
To use the Microsoft Edge Add-ons API, you need to enable the API for your project in the Microsoft Partner Center, by creating API credentials. Use the following steps to create API credentials.
Visit Microsoft Partner Center and sign in to the account that you used to publish an add-on.
Under the Microsoft Edge program, select Publish API.
On the Publish API page, click the Create API credentials button. This step may take a few minutes to finish.
The API credentials have now been created; you've enabled or renewed the API. The Client ID, Client secret, Expiry date, and Access token URL are now displayed on the Publish APIs page:
Write down the Client ID, Client secret and the Access token URL. You'll use these values in the next step, to get an access token.
Important
Be sure to write down the client secret now, because it's only visible immediately after enabling or renewing the API (that is, after creating API credentials). This particular secret isn't shown again.
You can generate multiple client secrets for your client ID. For example, you can create multiple secrets for multiple projects.
Retrieving the access token
After you've acquired the necessary authorization for your application, get access tokens for APIs. To get a token using the client credentials grant, send a POST request to the Access token URL (the OAuth token). The tenant information is available in the URL that you received in the Before you begin steps above.
Endpoint: https://login.microsoftonline.com/5c9eedce-81bc-42f3-8823-48ba6258b391/oauth2/v2.0/token
Type: POST
Header Parameters: Content-Type: application/x-www-form-urlencoded
Sample request
> curl \
-X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id={$Client_ID}" \
-d "scope=https://api.addons.microsoftedge.microsoft.com/.default" \
-d "client_secret={$Client_Secret}" \
-d "grant_type=client_credentials" \
-v \
https://login.microsoftonline.com/5c9eedce-81bc-42f3-8823-48ba6258b391/oauth2/v2.0/token
Sample response
{
"token_type": "Bearer",
"expires_in": 3599,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBP..."
}
For more information, see Get a token in Microsoft identity platform and the OAuth 2.0 client credentials flow.
Using the API endpoints
After you have an access token, you can use the Microsoft Edge Add-ons API. This API exposes endpoints for getting a list of products, updating products, and publishing products.
Note
There's no API for creating a new product or updating a product's metadata. For example, the description. You must complete these tasks manually in Microsoft Partner Center.
The API is available at the endpoint https://api.addons.microsoftedge.microsoft.com
Uploading a package to update an existing submission
Use this API to update the package for an add-on. This API uploads a package to update an existing draft submission of an add-on product.
Endpoint: /v1/products/$productID/submissions/draft/package
Type: POST
Header Parameters: Authorization: Bearer $TOKEN; Content-Type: application/zip
Body content: the package file to upload
$productID
is the product ID of the Microsoft Edge Add-on that you want to update.
Follow these steps to get the product ID:
Sign in to Microsoft Partner Center.
Go to Microsoft Edge > Overview.
Select the extension for which you want the product ID.
The Extension overview page opens. The product ID is shown in the page. (The product ID is also shown as the GUID in the URL in the Address bar, between
microsoftedge/
and/packages
.)In the Extension identity section (or from the Address bar), select and copy the Product ID.
Sample request
> curl \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/zip" \
-X POST \
-T $FILE_NAME \
-v \
https://api.addons.microsoftedge.microsoft.com/v1/products/$productID/submissions/draft/package
If the request succeeds and the update process begins, you receive a 202 Accepted
response status code with a Location
header. This location header contains the operationID
that's required for checking the status of the update operation.
See also:
- Upload a package to update an existing submission in REST API Reference for Microsoft Edge Add-ons.
Checking the status of a package upload
Use this API to check the status of package upload.
Endpoint: /v1/products/$productID/submissions/draft/package/operations/$operationID
Type: GET
Header Parameters: Authorization: Bearer $TOKEN
Sample request
> curl \
-H "Authorization: Bearer $TOKEN" \
-X GET \
-v \
https://api.addons.microsoftedge.microsoft.com/v1/products/$productID/submissions/draft/package/operations/$operationID
See also:
- Check the status of a package upload in REST API Reference for Microsoft Edge Add-ons.
Publishing the submission
Use this API to publish the current draft of the product to the Microsoft Edge Add-ons website.
Endpoint: /v1/products/$productID/submissions
Type: POST
Header Parameters: Authorization: Bearer $TOKEN
Body content: Notes for certification, in JSON format
Sample request
> curl \
-H "Authorization: Bearer $TOKEN" \
-X POST \
-d '{ "notes"="text value" }' \
-v \
https://api.addons.microsoftedge.microsoft.com/v1/products/$productID/submissions
If the request succeeds and the publishing process begins, you'll receive a 202 Accepted
response status code with a Location
header. This location header contains the operationID
that's required for checking the status of the publish operation.
See also:
- Publish the product draft submission in REST API Reference for Microsoft Edge Add-ons.
Checking the publishing status
Use this API to check the status of the publish operation.
Endpoint: /v1/products/$productID/submissions/operations/$operationID
Type: GET
Header Parameters: Authorization: Bearer $TOKEN
Sample request
> curl \
-H "Authorization: Bearer $TOKEN" \
-X GET \
-v \
https://api.addons.microsoftedge.microsoft.com/v1/products/$productID/submissions/operations/{operationID}
See also:
- Check the publishing status in REST API Reference for Microsoft Edge Add-ons.
See also
- REST API Reference for Microsoft Edge Add-ons
- Issues in
edge-developer
Docs repo. - Microsoft identity platform and the OAuth 2.0 client credentials flow
- Supported APIs for Microsoft Edge extensions - JavaScript APIs for developing an extension.