Is there an API for Mozilla for updating addons?

(Jacquiline Train) #1

I have an addon that I use personally but would like to experiment with making it distributable via AMO. I have already uploaded the initial version through the Developer Hub, and I’m now hoping to be able to include an automated release through a CI pipeline.

I’ve been investigating how to do this for a while now, having found this article and API doc but haven’t had much luck. I’m definitely able to connect with my JWT properly, as I get either a 301 (I assume this is because the API described in the article has been changed in the last two years) but then a 400 when I follow the redirects.

Every request returns Missing “upload” key in multipart file data. I believe this is to do with the endpoint being a PUT but expecting a multipart form (all my research points to this being supported by POST only). I’ve tried several different approaches, both with cURL and with various Python libraries - including PyCurl to try and use the multipart in a POST request and override only the method to PUT - but just don’t seem to be getting anywhere.

I haven’t been able to find any recent documentation on this, as the older articles imply it’s a deprecated API but the newer docs don’t seem to have the answers I’m looking for. Issues like this one suggest it’s still possible, and I’ve seen mention of web-ext but I think I’m just missing how to put the pieces together.

My request is:

curl -XPUT [{myId}/versions/0.2]({myId}/versions/0.2) -F 'upload=../toolbox.api' -H 'Authorization: JWT <myToken>' -v -L

Has anyone tried to do this and have any advice on how to move forward? Or conversely know that it’s definitely not possible?

Thanks in advance!

(Martin Giger) #2

The two clients linked in the documentation you linked certainly aren’t deprecated and both still use that endpoint, so so it surely isn’t deprecated.
I’ve only ever used the API via the web-ext tool.

(Jacquiline Train) #3

Hi, thanks for your reply. It’s cleared some things up in terms of what is and isn’t being used (I always get a bit wary when documentation links around to something with deprecated on it and the original articles are quite old). Nice to know everything is still in use!

On your suggestion I took more of a look into web-ext and tried it out, and I’m frustrated that I didn’t come across it sooner - it’s so easy to use! This should be easy enough to combine into my CI pipeline and allow for auto updating.

Many thanks :slight_smile:

(Martin Giger) #4

Note that you can’t use web-ext yet to publish new versions of listed extensions, but that’s being worked on afaik.