Skip to content
Browse files

Updated README

  • Loading branch information...
1 parent 6b6e866 commit d3e30f989c52386774e4aeb4a4996d0dd3ab3e5c Chavez committed Apr 6, 2012
Showing with 64 additions and 25 deletions.
  1. +64 −25 README.md
View
89 README.md
@@ -1,65 +1,104 @@
-npm install -g
-npm link
-node // for console
+Node.js AuthorityLabs Partner API Package
+=========================================
- // Example So Far
+A wrapper around the Partner API calls. Allows post, priority post and get calls.
+
+* Github: http://github.com/mtchavez/node-al-papi
+
+## Install
+
+ npm install al-papi
+
+## Usage
+
+Make a request object using your api key:
+
+ // Require al-papi
var al = require('al-papi');
- al.AlConfig('yRRBtB99jSIovMy6y6K0');
+
+ // Configure using your api-key
+ al.AlConfig('yRR2tB39jStovMy6y6xP');
+
+ // Make request object to make api calls
var req = new al.AlRequest();
- req.post({'keyword' : 'Centaur Carnage'}, function(response) {
- console.log('Code:');
+### POST
+
+Post your keyword-engine-locale combination to the API:
+
+ req.post({'keyword' : 'Centaur Soirée'}, function(response) {
+
console.log(response.statusCode);
- console.log('URL:');
console.log(response.url);
- console.log('Params:');
console.log(response.params);
if (response.success) {
- console.log('Body:');
console.log(response.body);
}
else {
- console.log('Error:');
console.log(response.errorMessage);
}
});
-
+
+### Priority POST
+
+Post your keyword to the priority queue if you need results in a more timely manner:
+
req.priority_post({'keyword' : 'Centaur Soirée'}, function(response) {
- console.log('Code:');
console.log(response.statusCode);
- console.log('URL:');
console.log(response.url);
- console.log('Params:');
console.log(response.params);
if (response.success) {
- console.log('Body:');
console.log(response.body);
}
else {
- console.log('Error:');
console.log(response.errorMessage);
}
});
-
- req.get({'keyword' : 'Centaur Carnage'}, function(response) {
- console.log('Code:');
+### GET
+
+When you are ready to get your results you can do a GET request for your keyword-engine-locale combo:
+
+ req.get({'keyword' : 'Centaur Soirée'}, function(response) {
+
console.log(response.statusCode);
- console.log('URL:');
console.log(response.url);
- console.log('Params:');
console.log(response.params);
if (response.success) {
- console.log('Body:');
console.log(response.body);
}
else {
- console.log('Error:');
console.log(response.errorMessage);
}
});
-
+
+### Response
+
+When making an API request a response object is returned with any errors, http response code and http reponse body.
+
+ req.get({'keyword' : 'Centaur Soirée'}, function(response) {
+
+ console.log(response.statusCode); // Status code of response
+ console.log(response.url); // The URL used for your request
+ console.log(response.params); // Original params given
+
+ // success is a true/false of if the request received a 200 response code
+ if (response.success) {
+ // Body will be the parsed JSON response
+ console.log(response.body);
+ }
+ else {
+ // Error message if one exists
+ console.log(response.errorMessage);
+ }
+ });
+
+## License
+
+Written by Chavez
+
+Released under the MIT License: http://www.opensource.org/licenses/mit-license.php

0 comments on commit d3e30f9

Please sign in to comment.
Something went wrong with that request. Please try again.