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,169
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:	98
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,567
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,169
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,169
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: 13
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,169
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

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