Thread Tools Display Modes
02-04-15, 05:22 PM   #1
Cairenn
Credendo Vides
 
Cairenn's Avatar
Premium Member
WoWInterface Admin
Join Date: Mar 2004
Posts: 7,134
WoWInterface AddOn update API

How to use the WoWIinterface API via Curl:

API Token method:
Generate your API token here.
  • Keep this token private as it has access to submit updates to your AddOn via our API.
  • Delete the token at any time to revoke its access to your AddOns
  • Team members can generate their own api token, no need to share yours.

GET AddOns you have access to:
Code:
curl -H "x-api-token: <Your Token>" https://api.wowinterface.com/addons/list.json
GET AddOn details:
Code:
curl -H "x-api-token: <Your Token>" https://api.wowinterface.com/addons/details/<id>.json
POST Updates: (If you GET the endpoint it will list what can be changed via this endpoint)
Code:
curl -H "x-api-token: <Your Token>" -F "id=8163" -F "version=123456789" -F "compatible=6.0.3" -F "updatefile=@/Users/dolby/Downloads/test2.zip" https://api.wowinterface.com/addons/update
List of valid data you can POST:
Just do a GET on http://api.wowinterface.com/addons/update and you’ll receive an error with a list of valid data points.


Cookie method (legacy):


Make a cookie file to authenticate with, you’ll only need to do this until the cookie expires:

curl -c cookies.txt -d "vb_login_username=<username>&vb_login_password=<password>&do=login&cookieuser=1" https://secure.wowinterface.com/forums/login.php
Use the cookie file you made to send requests to the API:
  • GET AddOns you have access to:
  • GET AddOn details:
  • curl -b cookies.txt http://api.wowinterface.com/addons/details/<addon id>.json
  • POST Updates: (If you GET the endpoint it will list what can be changed via this endpoint)
  • curl -b cookies.txt -F "id=<addon id>" -F "version=<your addon version number>" -F "compatible=<patch numbers, comma delimited>" -F "updatefile=@/path/to/local/file.zip" http://api.wowinterface.com/addons/update
  • List of valid data you can POST:


BigWigs' packager project: https://github.com/BigWigsMods/packager. Info here.


HTTP:
Error Responce:
  • 403 - You must be authenticated to use this API. (Missing or invalid token or cookie)
  • 404 - No AddOns found. (You don't have any AddOns)
  • 404 - ID(s) are missing for AddOn details.
  • 405 - Missing required data fields for AddOn Update (See actual error message for a list of fields)
  • 403 - AddOn Disabled (An admin has disabled your AddOn)
  • 401 - Permission Denied (You are not the author or team member of this AddOn)
  • 415 - File type not supported (You have tried to upload a file other than a zip/rar)
  • 500 - File update failed (Contact an admin, something bad happened)

Normal Response:
  • 200 - (Returned when you successfully GET data from the API)
  • 202 - Update Accepted. (Returned when you POST an update to your AddOn)

Last edited by Cairenn : 10-01-18 at 11:04 PM.
  Reply With Quote
02-04-15, 06:42 PM   #2
Marthisdil
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 363
Originally Posted by Cairenn View Post
How to use the WoWIinterface API via Curl:

Make a cookie file to authenticate with, you’ll only need to do this until the cookie expires:
(*ZAM is working on a public oauth endpoint so in the future you’ll be able to get an access token. Right now you’ll need to get the auth cookies from our local login system.)
curl -c cookies.txt -d “vb_login_username=<username>&vb_login_password=<password>&do=login&cookieuser=1" https://secure.wowinterface.com/forums/login.php
Use the cookie file you made to send requests to the API:
  • GET AddOns you have access to:
  • GET AddOn details:
  • curl -b cookies.txt http://api.wowinterface.com/addons/details/<addon id>.json
  • POST Updates: (If you GET the endpoint it will list what can be changed via this endpoint)
  • curl -b cookies.txt -F “id=<addon id>" -F “version=<your addon version number>" -F “compatible=<patch numbers, comma delimited>" -F "updatefile=@/path/to/local/file.zip" http://api.wowinterface.com/addons/update
  • List of valid data you can POST:
To use P3lim’s AddOn Packager Proxy: please see this thread.

Auto-pull from Curse:
You will need to:
  • If you don't already have the addon in question on WoWInterface - upload an old version of your addon to here, not the most recent version. Put in your description, screenshots, etc. If you already have the addon hosted here, skip to the next step.
  • Once you've uploaded it, give me a link to it here and on Curse, please.
  • Then I tick a couple boxes and it should grab the most recent from Curse, and from then on will auto-magically pull from Curse any time you update your addon there.
  • In addition you will need to provide written confirmation that we are pulling from Curse at your behest, via posting in this thread.
So - you guys killed the old, awesome, addon updaters from the past from pulling from your site, and now you're ok with pulling from Curse?

Funny how things work.
__________________

Marth



  Reply With Quote
02-04-15, 06:47 PM   #3
Cairenn
Credendo Vides
 
Cairenn's Avatar
Premium Member
WoWInterface Admin
Join Date: Mar 2004
Posts: 7,134
No, there is a huge difference here.

They used our site to serve the addons. We do a single pull from Curse which is uploaded to our site. We don't use their site to serve the addons.

And we do it with the full permission from the author.
  Reply With Quote
02-05-15, 03:24 AM   #4
humfras
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 131
Originally Posted by Marthisdil View Post
So - you guys killed the old, awesome, addon updaters from the past from pulling from your site, and now you're ok with pulling from Curse?

Funny how things work.


In the past, when updating the curse svn or github etc., you grapped the newest version from there and uploaded it here.
So technically, it's the same, just automated.

On the topic:
Good idea to start with.
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker

Last edited by humfras : 02-05-15 at 03:26 AM.
  Reply With Quote
02-05-15, 11:19 AM   #5
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Is there a method to query which wowi-svn is connected to a project?
So that I could query the addon-list, query the addons for related svn, check out from svn , build zip and finally upload to wowi (and curse)?
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
02-06-15, 07:39 AM   #6
schnoggo
A Fallenroot Satyr
 
schnoggo's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 20
Great minds... I was about to propose something very similar.
Grats P3lim & Dolby.
  Reply With Quote
02-06-15, 11:27 AM   #7
Marthisdil
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 363
yeah - I didn't think Curse would like you pulling stuff from their site automatically (I see you removed the 3rd option in your original post).

edit: also glad you deleted my original post questioning as such. /sarcasm
__________________

Marth



  Reply With Quote
02-06-15, 11:28 AM   #8
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by Marthisdil View Post
yeah - I didn't think Curse would like you pulling stuff from their site automatically (I see you removed the 3rd option in your original post).
they have a seperate thread to provide author permissions
__________________
Tweets YouTube Website
  Reply With Quote
02-06-15, 01:32 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Marth: WoWI pulling once with the author's permission (the same as if the author used the repo on Curse to create a .zip and then downloaded the .zip to upload here) is WAAAAAY different than a 3rd party program either a) using all of WoWI's and Curse's bandwidth to allow users to download files constantly without letting us get the traffic to generate revenue, or b) stealing addons without authors permission to upload them somewhere they have no knowledge of.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh


Last edited by Cairenn : 02-06-15 at 01:54 PM.
  Reply With Quote
02-06-15, 01:40 PM   #10
Cairenn
Credendo Vides
 
Cairenn's Avatar
Premium Member
WoWInterface Admin
Join Date: Mar 2004
Posts: 7,134
Originally Posted by Marthisdil View Post
yeah - I didn't think Curse would like you pulling stuff from their site automatically (I see you removed the 3rd option in your original post).

edit: also glad you deleted my original post questioning as such. /sarcasm
The option is still available, I just moved it to it's own thread, as pointed out by others. I removed it from this thread because we'd rather it be a 'last resort' type of thing. We'd prefer that people use any of the other options available. But it is still available and it is still posted about.

As for your edit: I was trying to be kind by preventing you from being looked at in a less-than-flattering light. My apologies. I've restored your post, along with my original response and the response of another user.

Last edited by Cairenn : 02-06-15 at 04:26 PM.
  Reply With Quote
02-06-15, 05:16 PM   #11
humfras
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 131
Originally Posted by Cairenn View Post
another user.
HEY!
Is this the reward for always trying to be helpful and gentle?

Anyways.
Is there a legal difference for AddOns I manage and the ones were im declared as a team member?
(At curse, I have manager status on all my projects.)
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker

Last edited by humfras : 02-06-15 at 05:19 PM.
  Reply With Quote
02-13-15, 08:56 AM   #12
Dorwido
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Apr 2006
Posts: 54
Due the P3lim’s AddOn Packager Proxy needs github which I dont like, hacked myself a script together to update it, its located at
https://github.com/Dorwido/wowiupdater

Its still work in progress, but I updated 3 addons of mine successfully with it.

How it works:
It fetches the addon list from here, you can then choose which addon to update it looks then on curseforge for the lateast release of that file (it skips alphas,betas) it compares then the filename of the latest release with the latest release filename from here if they match it stops if not it grabes then the filename, version, addon description (it strips out the default image if there is any and convert html to bbcode) and download the file.
Then it post here the new version, updating the version and also the addon description.
Be aware of the part with the addon description there is currently no option to turn it off, its converted from html to bbcode

It requires requests and html2bbcode both mentioned in the requirements.txt

How to use:
python sync.py fetch # to get the addon list here
python sync.py update <addonname> #example of one of my addon python sync.py update "Flight Map Enhanced & Times"

Thats it.

First time you use it it will ask for you wowinterface username/password
First time you update an addon it will ask for the curseforge slug name, in the above example that would be: flight-map-enhanced

To do:
adding a changelog handler (many ppl to it different on curseforge, so there is no way todo it one way for all)
rechecking addon details before doing the update, currently it looks in the saved addon list only and even on fetch dont update existing addons only on doing an update which could lead to wrong last file name, if doing an update without the script.
__________________
Auction Analytics
http://www.wowauction.org/
  Reply With Quote
02-13-15, 03:14 PM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Dorwido View Post
Due the P3lim’s AddOn Packager Proxy needs github which I dont like, hacked myself a script together to update it, ...
You may also be interested in jlam's standalone packager which replaces the CurseForge packager. You could easily use this in conjunction with the WoWInterface API to create a ZIP file and upload it to both sites (or just WoWInterface if you don't host on Curse too). It should work with any Git-based project regardless of where you host your remote repository(ies).
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
02-14-15, 06:00 PM   #14
jlam
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 29
Originally Posted by Phanx View Post
You may also be interested in jlam's standalone packager which replaces the CurseForge packager. You could easily use this in conjunction with the WoWInterface API to create a ZIP file and upload it to both sites (or just WoWInterface if you don't host on Curse too). It should work with any Git-based project regardless of where you host your remote repository(ies).
curseforge-packager is a shell script that you can get from GitHub. If you have Git for Windows and a standard SVN installation on your system, you should have all of the tools used by the shell script to do a full release. You just run it as
Code:
sh release.sh -z
, or if you also have 7-zip, you can just run
Code:
sh release.sh
and a zipfile will be generated as well.

-----------------------------------

release.sh

release.sh generates an addon zipfile from a Git or SVN checkout.

release.sh works by creating a new project directory, checking out external repositories within the project directory, then copying files from the checkout into the project directory. The project directory is then zipped to create a distributable addon zipfile.

release.sh reads .pkgmeta and supports the following directives:
  • externals (Git and SVN)
  • ignore
  • license-output (for default All Rights Reserved license)
  • manual-changelog
  • move-folders
  • package-as

release.sh supports the following repository substitution keywords when copying the files from the checkout into the project directory.
  • @alpha@...@end-alpha@
  • @debug@...@end-debug@
  • @localization(locale="locale", format="format", ...)@
    • escape-non-ascii
    • handle-subnamespaces
    • handle-unlocalized
    • namespace
  • @no-lib-strip@...@end-no-lib-strip@
  • @non-alpha@...@end-non-alpha@
  • @non-debug@...@end-non-debug@
  • @project-revision@
  • @project-version@

release.sh reads the TOC file, if present, to determine the name of the project.

release.sh assumes that tags (Git annotated tags and SVN tags) are named for the version numbers for the project. It will identify if the HEAD is tagged and use that as the current version number. It will search back through parent commits for the previous tag that is a release version number and generate a changelog containing the commits since that previous release tag.

release.sh will create a default license file in the project directory with the contents All Rights Reserved if a license file does not already exist.

By default, release.sh creates releases in a release subdirectory of the top-level directory of the checkout.

Using release.sh

The recommended way to include release.sh in a project is to:
  1. Create a release subdirectory in your top-level checkout.
  2. Copy release.sh into the release directory.
  3. Ignore the release subdirectory in .pkgmeta.
  4. Run release.sh.
  Reply With Quote
02-14-15, 06:25 PM   #15
Dorwido
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Apr 2006
Posts: 54
Originally Posted by Phanx View Post
You may also be interested in jlam's standalone packager which replaces the CurseForge packager. You could easily use this in conjunction with the WoWInterface API to create a ZIP file and upload it to both sites (or just WoWInterface if you don't host on Curse too). It should work with any Git-based project regardless of where you host your remote repository(ies).
na adding changelog and i am happy with my script, one click to update here, just miss the api here to upload images too :-P
__________________
Auction Analytics
http://www.wowauction.org/
  Reply With Quote
02-14-15, 07:25 PM   #16
Dolby
PPAP
 
Dolby's Avatar
WoWInterface Admin
Join Date: Feb 2004
Posts: 2,339
Originally Posted by Dorwido View Post
just miss the api here to upload images too :-P
Working on it
  Reply With Quote
02-14-15, 07:33 PM   #17
Dorwido
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Apr 2006
Posts: 54
Originally Posted by Dolby View Post
Working on it
nice cant await it :-D
__________________
Auction Analytics
http://www.wowauction.org/
  Reply With Quote
02-16-15, 07:09 AM   #18
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
For those who would want to use my tool, but don't want to use GitHub, please see this.
It might happen, it might not, it depends on if the good people over at CurseForge would want to implement some way of hooking into the packager (the alternative would be scraping on intervals, which I don't want to do).
The issue on GitHub I linked above will be updated as it progresses (or not).
  Reply With Quote
08-08-16, 04:44 PM   #19
Cairenn
Credendo Vides
 
Cairenn's Avatar
Premium Member
WoWInterface Admin
Join Date: Mar 2004
Posts: 7,134
Giving this a bump as the API token method has gotten some love in the last little bit. First post is updated with the new info.
  Reply With Quote
08-08-16, 10:06 PM   #20
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Using an API token instead of a cookie to upload a file, is it intended that there's no response body, and the only status codes returned are 200 (on a successful upload) or 00000 (for any error, which isn't even a valid HTTP status)?

It would be nice to get standard error codes like 404 (for missing/bad addon ID) or 403 (for missing/bad API token) and a message specifying the actual problem in other cases (missing/bad file, etc). For miscellaneous errors the CurseForge API gives a 422 (Unprocessable Entity) but there are plenty of 4xx statuses to choose from.

Also, to be pedantic, 201 (Created) or 202 (Accepted) would be more appropriate than 200 (OK).
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Tutorials & Other Helpful Info. » WoWInterface AddOn update API

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off