Commit c5144137 authored by Aaron Tidwell's avatar Aaron Tidwell

readme

parent 6b5ecfcc
http://api.challonge.com/v1
shows particpants.randomize as GET when method is actually POST
http://api.challonge.com/v1/documents/participants/create
shows participant_id as a required field when the server does not respect passing this and it is not required
http://api.challonge.com/v1/documents/participants/randomize
shows participant_id as a required field when the server does not respect passing this and it is not required
server response has invalid headers causing [Error: Parse Error] bytesParsed: 0, code: 'HPE_INVALID_CONSTANT' in node
\ No newline at end of file
......@@ -48,7 +48,6 @@ Client.prototype.makeRequest = function(obj) {
propertiesToDelete.forEach(function(prop){ delete obj[prop]; });
//generate path
path = path + '.' + format + '?' + qs.stringify(obj) + compiledParams;
......@@ -57,7 +56,7 @@ Client.prototype.makeRequest = function(obj) {
path: path,
method: method,
headers: {
'Content-Length': 0
'Content-Length': 0 //server throww nginx error without a content-length
}
};
......
##This is in very early alpha
##example
####This is in very early alpha
---
##super basic example
checkout this repo into ./
To get all tournaments on your account:
```
var challonge = require('./node-challonge');
......@@ -11,22 +13,19 @@ var client = challonge.createClient({
apiKey: '***yourAPIKey***'
});
function index() {
client.tournaments.index({
callback: function(err,data){
if (err) { console.log(err); return; }
console.log(data);
}
});
}
```
client.tournaments.index({
callback: function(err,data){
if (err) { console.log(err); return; }
console.log(data);
}
});
For docs: http://api.challonge.com/v1
```
Library is organized into resource.method
The wrapper is organized into resource.method to match the API
For API calls that require nested params (eg: http://api.challonge.com/v1/documents/tournaments/create) properties should be specified nested. example:
For API calls that require nested params (eg: http://api.challonge.com/v1/documents/tournaments/create) properties should be specified as a nested config option.
```
var challonge = require('./node-challonge');
......@@ -46,6 +45,24 @@ client.tournaments.create({
}
});
```
---
###test/test.js has examples of all the api methods.
---
###Challonge docs: http://api.challonge.com/v1
----
##Comments
Server throws nginx error without a content-length in header.
All methods are qs based, so I would assume nginx would ignore content-length for api requests (it is optional in the spec). I lost about 20 mins to this one because node doesn't auto-calculate content-length in the core https lib.
---
##Etc
The other language wrappers are AWESOME. I consulted their sources often when trying to figure out WTF the API actually wanted. One of the most important examples was from the python lib's api.py - it confirmed I wasn't insane about how to construct the querystring. Ruby and PHP provide native ways to encode objects in ```object[property]=value``` syntax, but python and node don't.
---
##TODO
1. fix randomize
......@@ -54,5 +71,23 @@ client.tournaments.create({
4. docs
5. tests
##BTW
The structure of this API is ripped off from https://github.com/nodejitsu/nodejitsu-api - its too darn good not to copy
\ No newline at end of file
---
##Bugs in the API
server 500s if trying to finalize() a tournament that has not yet been start()ed
http://api.challonge.com/v1 shows particpants.randomize as GET when method is actually POST
http://api.challonge.com/v1/documents/participants/create shows participant_id as a required field when the server does not respect passing it, and is not required.
http://api.challonge.com/v1/documents/participants/randomize shows participant_id as a required field when the server does not respect passing it, and is not required.
Also, I think the server might be sending an invalid header on randomize somehow. Node doesn't handle invalid headers well, will look into the causes for:
```
[Error: Parse Error] bytesParsed: 0, code: 'HPE_INVALID_CONSTANT' in node.
```
---
###The structure of this API is ripped off from https://github.com/nodejitsu/nodejitsu-api - its too darn good not to copy
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment