Quantcast WoWInterface AddOn update API - Page 2 - WoWInterface
Thread Tools Display Modes
08-09-16, 09:16 AM   #21
Dolby
PPAP
 
Dolby's Avatar
WoWInterface Admin
Join Date: Feb 2004
Posts: 2,235
Originally Posted by Phanx View Post
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).
We never had a body response when POSTing to the API unless there was an error, cookie or token. I'll add one.

When were you getting a 00000? You should get 40x's for missing token and other various errors? Not even sure how a 00000 could happen unless maybe our WAF is detecting something and doing something goofy, even then I've never seen it use those response codes?

Edit: you should now get a 202 and a response body when you successfully POST to the update endpoint.
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2016-08-09 at 10.24.03 AM.png
Views:	219
Size:	52.1 KB
ID:	8777  

Last edited by Dolby : 08-09-16 at 09:36 AM.
  Reply With Quote
08-09-16, 09:43 AM   #22
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
That's weird. When I run the same test script I was using yesterday, I'm now getting meaningful error codes and responses.

Code:
curl \
  -w "%{http_code}" -o "result.txt" \
  -H "X-API-Token: MYAPITOKENHERE" \
  -F "id=23261" \
  -F "version=7.0.3.2" \
  -F "compatible=7.0.3" \
  -F "[email protected]" \
  "https://api.wowinterface.com/addons/update"
Yesterday this (with a missing or invalid API token, or a missing "id" field) was printing "00000" in the terminal, and not creating a "result.txt" file. Today it's printing 403 in the terminal (with a missing or invalid API token) and a useful message in result.txt. (Missing addon ID is 404, invalid addon ID is 401 even for addon IDs that don't exist yet on the site.)

Though, there is a typo in the error message:
Code:
{"ERROR":"You must be authenicated to use this API."}
I'll keep an eye on it and let you know if I see anything weird again.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
08-09-16, 09:50 AM   #23
Dolby
PPAP
 
Dolby's Avatar
WoWInterface Admin
Join Date: Feb 2004
Posts: 2,235
Very strange, if it happens again please let me know.

Thanks for the heads up on the typo.
  Reply With Quote
08-11-16, 12:46 PM   #24
Dolby
PPAP
 
Dolby's Avatar
WoWInterface Admin
Join Date: Feb 2004
Posts: 2,235
Just an update, since our ssl can be HTTP/2 a header field needs to be lower case. I have updated the API to accept 'x-api-token' as well (used to only accept 'X-API-Token' and I suggest others update their header fields. The upper case version will still work since cloudflare converts it for us.

Source: Section 8.1.2 of RFC 7540

So if you were randomly receiving {"ERROR":"You must be authenticated to use this API."} this has been fixed.

Last edited by Dolby : 08-11-16 at 12:51 PM.
  Reply With Quote
08-11-16, 01:44 PM   #25
nebula
A Deviate Faerie Dragon
 
nebula's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 14
Dolby, my hero
  Reply With Quote
11-18-16, 01:27 PM   #26
Dolby
PPAP
 
Dolby's Avatar
WoWInterface Admin
Join Date: Feb 2004
Posts: 2,235
I don't think many of you use this endpoint but...

P3lim requested the datapoint named 'default' be switched away from the string Yes / No to the json true / false. So any one using the https://api.wowinterface.com/addons/compatible.json endpoint and the default data point will need to check their release scripts.
  Reply With Quote
05-29-17, 07:22 PM   #27
StormFX
A Theradrim Guardian
 
StormFX's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 62
So does the API let us use web hooks from say GitHub to publish our releases? And if so, does the packager support the same stuff as Curse does? Primarily, pkgmeta.yaml? (didn't see any in-depth docs on it) Would save me TONS of time to not have to upload every archive each time I update. And those other methods are actually more of a hassle.

Would be nice to just push to GitHub and have Curse/WoWI auto-package for me.
  Reply With Quote
05-29-17, 07:38 PM   #28
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,693
The API is just an alternate way of uploading to the site, allowing the manual uploading to be scripted/automated, no packaging involved.
Afaik, Dolby is already working on a true packager, or at the very least is considering it, he'll have to comment on that though.

If you want to completely automate it with as little effort as possible, take a look at BigWigs' packager project: https://github.com/BigWigsMods/packager.
This can be automated with TravisCI to automatically package and upload for you, an example can be found in the main BigWigs project repo (.travis.yml)

Last edited by p3lim : 05-29-17 at 07:41 PM.
  Reply With Quote
05-29-17, 07:56 PM   #29
StormFX
A Theradrim Guardian
 
StormFX's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 62
Ah. Thanks for the info, P3lim. I'll wait to see what Dolby has to say. I guess it doesn't matter since I still have to package usable releases for GitHub.
  Reply With Quote
05-30-17, 07:06 AM   #30
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,693
Their script supports uploading to CurseForge, Wowinterface and GitHub.
  Reply With Quote
10-14-17, 03:02 PM   #31
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,693
Originally Posted by p3lim View Post
If you want to completely automate it with as little effort as possible, take a look at BigWigs' packager project: https://github.com/BigWigsMods/packager.
This can be automated with TravisCI to automatically package and upload for you, an example can be found in the main BigWigs project repo (.travis.yml)
Made a guide on how to set this up:
http://www.wowinterface.com/forums/s...ad.php?t=55801
  Reply With Quote
09-01-19, 01:25 PM   #32
sykz
A Defias Bandit
 
sykz's Avatar
Join Date: Aug 2019
Posts: 2
Hi guys,

I'm currently playing with the API (from page 1). I'm using it to push files to DejaClassicStats https://www.wowinterface.com/downloa...tats.html#info

On the API call, I specify that the file I wanna push is for Classic, not Retail. The thing goes well, that's nice. But Dejablue (the AddOn author) cannot remove the latest "Release" tagged file (uploaded at 08/28/19 04:53 AM).

Note that DejaClassicStats only works on Classic, not Retail. Therefor, we need a way to remove the "R" / Retail version or this will confuse people.

Thanks!

Last edited by sykz : 09-01-19 at 01:46 PM.
  Reply With Quote
09-01-19, 01:45 PM   #33
Dolby
PPAP
 
Dolby's Avatar
WoWInterface Admin
Join Date: Feb 2004
Posts: 2,235
The updates for classic on the API are only for when you want to provide 2 releases on the addon info page. If you are just providing a classic release then use the normal 'updatefile' endpoint. I went and removed the classic updates so that you can submit them via the normal updatefile endpoint.

I am working on some changes so make this much more easy where you just tag the api release with the upload and it will take care of the rest.

Also classic uploads will only show the latest file atm, bug I'm working on. And classic specific uploads are not yet available on minion.

sorry for the trouble.

Last edited by Dolby : 09-01-19 at 01:53 PM.
  Reply With Quote
09-01-19, 01:52 PM   #34
sykz
A Defias Bandit
 
sykz's Avatar
Join Date: Aug 2019
Posts: 2
Originally Posted by Dolby View Post
The updates for classic on the API are only for when you want to provide 2 releases on the addon info page. If you are just providing a classic release then use the normal 'updatefile' endpoint. I went and removed the classic updates so that you can submit them via the normal updatefile endpoint.

I am working on some changes so make this much more easy where you just tag the api release with the upload and it will take care of the rest.

sorry for the trouble.
Thanks for your quick answer!

OK, so for now I'll be using the "Retail" field.

Will the future changes break anything on the API side? I guess not, but I just want to make sure. Please let us know when the changes are ready!

Thanks again. :thumbsup:

Last edited by sykz : 09-01-19 at 01:57 PM. Reason: Typo fix: Release => Retail
  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