{"id":9034,"date":"2022-03-17T19:00:03","date_gmt":"2022-03-18T02:00:03","guid":{"rendered":"https:\/\/blog.mozilla.org\/addons\/?p=9034"},"modified":"2022-05-24T04:45:09","modified_gmt":"2022-05-24T11:45:09","slug":"new-api-for-submitting-and-updating-add-ons","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/","title":{"rendered":"A new API for submitting and updating add-ons"},"content":{"rendered":"<p>The <a href=\"https:\/\/addons.mozilla.org?utm_source=blog.mozilla.org&amp;utm_medium=post&amp;utm_content=amo-api-v3-deprecation\">addons.mozilla.org<\/a> (AMO) <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/index.html\">external API<\/a> has offered add-on developers the ability to submit new add-on versions for signing for a number of years, in addition to being available to get data about published add-ons directly or internally inside Firefox.<\/p>\n<h2>Current \u201csigning\u201d API<\/h2>\n<p>Currently, the <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/signing.html\">signing api<\/a> offers some functionality, but it\u2019s limited &#8211; you can\u2019t submit the first listed version of an add-on (extra metadata is needed to be collected via developer hub); you can\u2019t edit existing submissions; you can\u2019t submit\/edit extra metadata about the add-on\/version; and you can\u2019t share the source code for an add-on when it\u2019s needed to comply with our policies. For all of those tasks you need to use the forms on the appropriate developer hub web pages.<\/p>\n<h2>New Add-on \u201csubmission\u201d API<\/h2>\n<p>The new add-on <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#create\">submission api<\/a> aims to overcome these limitations and (eventually) allow developers to submit and manage all parts of their add-on via the API. It\u2019s available now in our <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/overview.html#api-versions\">v5 api<\/a>, and should be seen as beta quality for now.<\/p>\n<h3>Submission Workflow<\/h3>\n<p>The submission workflow is split by the process of uploading the file for validation, and attaching the validated file to a new add-on, or as a new version to an existing add-on.<\/p>\n<ol>\n<li aria-level=\"1\">The add-on file to be distributed is uploaded via the <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#upload-create\">upload create<\/a> endpoint, along with the channel, returning an upload uuid.<\/li>\n<li aria-level=\"1\">The <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#id9\">upload detail<\/a> endpoint can be polled for validation status.<\/li>\n<li aria-level=\"1\">Once the response has <code>\"valid\": true<\/code>, it can be used to create either a new add-on, or a new version of an existing add-on. Sources may be attached if required.<\/li>\n<\/ol>\n<h4>Uploading the add-on file<\/h4>\n<p>Regardless of if you are creating a new add-on or adding a new version to an existing add-on, you will need to upload the file for validation first. Here you will decide if the file will be associated with a public listing (listed), or will be self-hosted (unlisted). See <a href=\"https:\/\/extensionworkshop.com\/documentation\/publish\/signing-and-distribution-overview\/#distributing-your-addon\">our guide on signing and distribution for further details<\/a>.<\/p>\n<pre># Send a POST request to the <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#upload-create\">upload create<\/a> endpoint\r\n# Pass addon.xpi as a file using multipart\/form-data, along with the\r\n# distribution channel.\r\ncurl -XPOST \"https:\/\/addons.mozilla.org\/api\/v5\/addons\/upload\/\" \\\r\n  -H \"Authorization: &lt;JWT blob&gt;\" \\\r\n  -F \"upload=@addon.xpi\" -F \"channel=listed\" \r\n<\/pre>\n<p>The response will provide information on successful validation, if <code>valid<\/code> is set to <code>true<\/code> you will be able to use the <code>uuid<\/code> in the next submission steps. The recommended polling interval is 5-10 seconds, making sure your code times out after a maximum of 10 minutes.<\/p>\n<h4>Creating a new add-on<\/h4>\n<p>When creating a new add-on, we require some initial metadata to describe what the add-on does, as well as some optional fields that will allow you to <a href=\"https:\/\/extensionworkshop.com\/documentation\/develop\/create-an-appealing-listing\/\">create an appealing listing<\/a>. Make a request to the <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#create\">add-ons create endpoint<\/a> to attach the uploaded file to a new add-on:<\/p>\n<pre># Send a POST request to the <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#create\">add-ons create endpoint<\/a>\r\n# Include the add-on metadata as JSON.\r\ncurl -XPOST \"https:\/\/addons.mozilla.org\/api\/v5\/addons\/addon\/\" \\\r\n  -H \"Authorization: &lt;JWT blob&gt;\" \\\r\n  -H \"Content-Type: application\/json\" -d @- &lt;&lt;EOF\r\n{\r\n  \"categories\": {\r\n    \"firefox\": [\"bookmarks\"]\r\n  },\r\n  \"summary\": {\r\n    \"en-US\": \u201cThis add-on does great things!\u201d\r\n  },\r\n  \"version\": {\r\n    \"upload\": \"&lt;upload-uuid&gt;\",\r\n    \"license\": \"MPL-2.0\"\r\n  }\r\n}\r\nEOF\r\n<\/pre>\n<p>When submitting to the self-hosted channel, you can omit extra metadata such as categories, summary or license.<\/p>\n<h4>Adding a version to an existing add-on<\/h4>\n<p>If instead you are\u00a0 adding a version to an existing add-on, the metadata has already been provided in the initial submission. The following request can be made to attach the version to the add-on:<\/p>\n<pre># Send a POST request to the <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#version-create\">versions create endpoint<\/a>.\r\n# Include the upload uuid from the previous add-on upload\r\ncurl -XPOST \"https:\/\/addons.mozilla.org\/api\/v5\/addons\/addon\/&lt;add-on id&gt;\/versions\/\" \\\r\n  -H \"Authorization: &lt;JWT blob&gt;\" -H \"Content-Type: application\/json\" \\\r\n  -d '{ \"upload\": &lt;upload-uuid&gt; }'\r\n<\/pre>\n<h3>Updating existing add-on or version metadata<\/h3>\n<p>Metadata on any existing add-ons or versions can be updated, regardless of how they have been initially submitted. To do so, you can use the <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#edit\">add-on edit<\/a> or <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#version-edit\">version edit<\/a> endpoints. For example:<\/p>\n<pre># Send a PATCH request to the <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#edit\">add-ons edit endpoint<\/a>\r\n# Set the slug and tags as JSON data.\r\ncurl -XPATCH \"https:\/\/addons.mozilla.org\/api\/v5\/addons\/addon\/&lt;add-on id&gt;\/\" \\ \\\r\n  -H \"Authorization: &lt;JWT blob&gt;\" -H \"Content-Type: application\/json\" \\\r\n  -d @- &lt;&lt;EOF\r\n{\r\n  \"slug\": \"new-slug\",\r\n  \"tags\": [\"chat\", \"music\"]\r\n}\r\nEOF<\/pre>\n<h3>Providing Source code<\/h3>\n<p>When an add-on\/version submission requires source code to be submitted it can either be uploaded while creating the version, or as an update to an existing version.\u00a0 Files are always uploaded as multipart\/form-data rather than JSON so <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#version-sources\">setting <code>source<\/code><\/a> can\u2019t be combined with every other field.<\/p>\n<pre># Send a PATCH request to the <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#version-edit\">version edit endpoint<\/a>\r\n# Pass source.zip as a file using multipart\/form-data, along with the license field.\r\ncurl -XPATCH \"https:\/\/addons.mozilla.org\/api\/v5\/addons\/addon\/&lt;add-on id&gt;\/versions\/&lt;version-id&gt;\/\"  \\\r\n  -H \"Authorization: &lt;JWT blob&gt;\" \\\r\n  -F \"source=@source.zip\" -F \"license=MPL-2.0\"<\/pre>\n<p>You may also provide the source code as part of adding a version to an existing add-on. Fields such as <code>compatibility<\/code>, <code>release_notes<\/code> or <code>custom_license<\/code> can\u2019t be set at the same time because complex data structures (lists and objects) can only be sent as JSON.<\/p>\n<pre># Send a POST request to the <a href=\"https:\/\/addons-server.readthedocs.io\/en\/latest\/topics\/api\/addons.html#version-create\">version create endpoint<\/a>\r\n# Pass source.zip as a file using multipart\/form-data,\r\n# along with the upload field set to the uuid from the previous add-on upload.\r\ncurl -XPOST \"https:\/\/addons.mozilla.org\/api\/v5\/addons\/addon\/&lt;add-on id&gt;\/versions\/\" \\\r\n  -H \"Authorization: &lt;JWT blob&gt;\" \\\r\n  -F \"source=@source.zip\" -F \"upload=500867eb-0fe9-47cc-8b4b-4645377136b3\"<\/pre>\n<p>&nbsp;<\/p>\n<h2>Future work and known limitations<\/h2>\n<p>There may be bugs &#8211; if you find any please <a href=\"https:\/\/github.com\/mozilla\/addons\/issues\/new\">file an issue<\/a>! &#8211; and the work is still in progress, so there are some known limitations where not all add-on\/version metadata that is editable via developer hub can be changed yet, such as adding\/removing add-on developers, or uploading icons and screenshots.<\/p>\n<p>Right now the <a href=\"https:\/\/extensionworkshop.com\/documentation\/develop\/getting-started-with-web-ext\/\">web-ext<\/a> tool (or <a href=\"https:\/\/github.com\/mozilla\/sign-addon\">sign-addon<\/a>) doesn\u2019t use the new submission API (they use the signing api); updating those tools is next on the roadmap.<\/p>\n<p>Longer term we aim to replace the existing developer hub and create a new webapp that will use the add-on submission apis directly, and also deprecate the existing signing api, leaving a single method of uploading and managing all add-ons on <a href=\"https:\/\/addons.mozilla.org\/\">addons.mozilla.org<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The addons.mozilla.org (AMO) external API has offered add-on developers the ability to submit new add-on versions for signing for a number of years, in addition to being available to get &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/\">Read more<\/a><\/p>\n","protected":false},"author":1304,"featured_media":8751,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,278886],"tags":[17,27000,278873],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>A new API for submitting and updating add-ons - Mozilla Add-ons Community Blog<\/title>\n<meta name=\"description\" content=\"We are introducing a new API for submitting add-ons to addons.mozilla.org, which overcomes a number of limitations the from the old API.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andrew Williamson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/\",\"name\":\"A new API for submitting and updating add-ons - Mozilla Add-ons Community Blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/blog.mozilla.org\/addons\/files\/2019\/10\/Fx-Browser-Nightly-icon-fullColor.png\",\"datePublished\":\"2022-03-18T02:00:03+00:00\",\"dateModified\":\"2022-05-24T11:45:09+00:00\",\"author\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/10f4605b8fa84a12bc216d95c415d3dd\"},\"description\":\"We are introducing a new API for submitting add-ons to addons.mozilla.org, which overcomes a number of limitations the from the old API.\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/#primaryimage\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/files\/2019\/10\/Fx-Browser-Nightly-icon-fullColor.png\",\"contentUrl\":\"https:\/\/blog.mozilla.org\/addons\/files\/2019\/10\/Fx-Browser-Nightly-icon-fullColor.png\",\"width\":2048,\"height\":2048,\"caption\":\"Firefox Nightly Logo\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.mozilla.org\/addons\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"A new API for submitting and updating add-ons\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#website\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/\",\"name\":\"Mozilla Add-ons Community Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.mozilla.org\/addons\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/10f4605b8fa84a12bc216d95c415d3dd\",\"name\":\"Andrew Williamson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6b19e02916b6a9f236d054f78f0abd95?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6b19e02916b6a9f236d054f78f0abd95?s=96&d=mm&r=g\",\"caption\":\"Andrew Williamson\"},\"url\":\"https:\/\/blog.mozilla.org\/addons\/author\/awilliamsonmozilla-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"A new API for submitting and updating add-ons - Mozilla Add-ons Community Blog","description":"We are introducing a new API for submitting add-ons to addons.mozilla.org, which overcomes a number of limitations the from the old API.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/","twitter_misc":{"Written by":"Andrew Williamson","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/","url":"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/","name":"A new API for submitting and updating add-ons - Mozilla Add-ons Community Blog","isPartOf":{"@id":"https:\/\/blog.mozilla.org\/addons\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/#primaryimage"},"image":{"@id":"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.mozilla.org\/addons\/files\/2019\/10\/Fx-Browser-Nightly-icon-fullColor.png","datePublished":"2022-03-18T02:00:03+00:00","dateModified":"2022-05-24T11:45:09+00:00","author":{"@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/10f4605b8fa84a12bc216d95c415d3dd"},"description":"We are introducing a new API for submitting add-ons to addons.mozilla.org, which overcomes a number of limitations the from the old API.","breadcrumb":{"@id":"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/#primaryimage","url":"https:\/\/blog.mozilla.org\/addons\/files\/2019\/10\/Fx-Browser-Nightly-icon-fullColor.png","contentUrl":"https:\/\/blog.mozilla.org\/addons\/files\/2019\/10\/Fx-Browser-Nightly-icon-fullColor.png","width":2048,"height":2048,"caption":"Firefox Nightly Logo"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.mozilla.org\/addons\/2022\/03\/17\/new-api-for-submitting-and-updating-add-ons\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.mozilla.org\/addons\/"},{"@type":"ListItem","position":2,"name":"A new API for submitting and updating add-ons"}]},{"@type":"WebSite","@id":"https:\/\/blog.mozilla.org\/addons\/#website","url":"https:\/\/blog.mozilla.org\/addons\/","name":"Mozilla Add-ons Community Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.mozilla.org\/addons\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/10f4605b8fa84a12bc216d95c415d3dd","name":"Andrew Williamson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6b19e02916b6a9f236d054f78f0abd95?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6b19e02916b6a9f236d054f78f0abd95?s=96&d=mm&r=g","caption":"Andrew Williamson"},"url":"https:\/\/blog.mozilla.org\/addons\/author\/awilliamsonmozilla-com\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/9034"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/users\/1304"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/comments?post=9034"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/9034\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/media\/8751"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/media?parent=9034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/categories?post=9034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/tags?post=9034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}