WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Tutorials & Other Helpful Info. (https://www.wowinterface.com/forums/forumdisplay.php?f=12)
-   -   WoWInterface AddOn update API (https://www.wowinterface.com/forums/showthread.php?t=51835)

Cairenn 02-04-15 05:22 PM

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)

Marthisdil 02-04-15 06:42 PM

Quote:

Originally Posted by Cairenn (Post 306078)
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.

Cairenn 02-04-15 06:47 PM

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.

humfras 02-05-15 03:24 AM

Quote:

Originally Posted by Marthisdil (Post 306080)
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.

Rilgamon 02-05-15 11:19 AM

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)?

schnoggo 02-06-15 07:39 AM

Great minds... I was about to propose something very similar.
Grats P3lim & Dolby.

Marthisdil 02-06-15 11:27 AM

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

10leej 02-06-15 11:28 AM

Quote:

Originally Posted by Marthisdil (Post 306171)
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

Seerah 02-06-15 01:32 PM

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.

Cairenn 02-06-15 01:40 PM

Quote:

Originally Posted by Marthisdil (Post 306171)
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.

humfras 02-06-15 05:16 PM

Quote:

Originally Posted by Cairenn (Post 306183)
another user.

HEY! :mad:
Is this the reward for always trying to be helpful and gentle? :rolleyes:

Anyways. :p
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.)

Dorwido 02-13-15 08:56 AM

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.

Phanx 02-13-15 03:14 PM

Quote:

Originally Posted by Dorwido (Post 306421)
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).

jlam 02-14-15 06:00 PM

Quote:

Originally Posted by Phanx (Post 306442)
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.

Dorwido 02-14-15 06:25 PM

Quote:

Originally Posted by Phanx (Post 306442)
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

Dolby 02-14-15 07:25 PM

Quote:

Originally Posted by Dorwido (Post 306480)
just miss the api here to upload images too :-P

Working on it :)

Dorwido 02-14-15 07:33 PM

Quote:

Originally Posted by Dolby (Post 306481)
Working on it :)

nice cant await it :-D

p3lim 02-16-15 07:09 AM

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).

Cairenn 08-08-16 04:44 PM

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.

Phanx 08-08-16 10:06 PM

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). :p


All times are GMT -6. The time now is 03:26 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI