Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,42 @@ The proxy parameter routes all requests through the specfied proxy.
###Examples
Fetch Mt. Gox Bitcoin dataset, and print response:
```javascript
quandl.dataset({ source: "BITCOIN", table: "MTGOXUSD" }, function(err, response){
quandl.dataset({ source: "BITCOIN", table: "MTGOXUSD" }, function(err, data){
if(err)
throw err;

console.log(response);
console.log(data);
});
```
Fetch dataset metadata, and print response:
```javascript
quandl.metadata("ZILLOW", "ZIP_ALLHOMES_15235", function(err, response){
quandl.metadata("ZILLOW", "ZIP_ALLHOMES_15235", function(err, data){
if(err)
throw err;

console.log(response);
console.log(data);
});
```

Search for datasets pertaining to "crude oil", and print xml response:
```javascript
quandl.search("crude oil", { format: "xml" }, function(err, response){
quandl.search("crude oil", { format: "xml" }, function(err, data){
console.log(err);
console.log(response);
console.log(data);
});
```

Response status, headers, etc. can be obtained by specifying a third parameter in the callback (see [http.IncomingMessage](https://nodejs.org/api/http.html)):
```javascript
quandl.dataset({ source: "BITCOIN", table: "MTGOXUSD" }, function(err, data, response){
if(err)
throw err;

if (response.statusCode === 200){
console.log(data);
} else {
console.error(response.statusCode, response.statusMessage, data);
}
});
```

Expand All @@ -103,11 +117,11 @@ quandl.dataset({
start_date: "2015-01-30",
end_date: "2016-01-29",
column_index: 4
}, function(err, response){
}, function(err, data){
if(err)
throw err;

console.log(response);
console.log(data);
});
```

Expand Down
2 changes: 1 addition & 1 deletion lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ exports.create = function(config, fn){
}

request(options, function(err, response, body){
fn(err, body);
fn(err, body, response);
});
}