Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kip Gebhardt committed May 13, 2015
2 parents c9f8ce8 + a2e7267 commit 58c1172
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,27 @@ $ npm test
```

## Examples
### Quick start
This example queries COVE for programs produced by PBS and requests the associated images.
* Ex: http://api.pbs.org/cove/v1/programs/?filter_producer__name=PBS&fields=associated_images
```
$ cd examples
$ export COVE_API_ID='YOUR COVE_API_ID'
$ export COVE_API_SECRET='YOUR COVE_API_SECRET'
$ node simple_request.js
```
Sample Code:
Output:
```
Async: results count: 200
Async: first image url: http://image.pbs.org/contentchannels/2340/MmFmdUNelPiWY1fJnGw.jpg.resize.144x81.jpg
Promises: results count: 200
Promises: first image url: http://image.pbs.org/contentchannels/2340/MmFmdUNelPiWY1fJnGw.jpg.resize.144x81.jpg
Promises w/ Header Auth: results count: 200
Promises w/ Header Auth: first image url: http://image.pbs.org/contentchannels/2340/MmFmdUNelPiWY1fJnGw.jpg.resize.144x81.jpg
```
### Sample Code
```javascript
var COVEApi = require('cove-api'),
colors = require('colors');
var COVEApi = require('cove-api');

// Get api credentials from Environment
var api_id = process.env.COVE_API_ID || null,
Expand All @@ -46,7 +57,7 @@ var coveAPI = new COVEApi(options);
var options = {};
coveAPI.request(url, options).
then(function(data){
console.log('Promises:'.blue + ' results count:'.green, data.results.length);
console.log('results count:', data.results.length);
})
.catch(function(e){
console.error(e);
Expand Down

0 comments on commit 58c1172

Please sign in to comment.