huddle_ai v1.0.1
huddle_ai
JavaScript client for Huddle AI. This module provide programmatic access to read and write Huddle AI data. Examples and interactive console below. Please contact tech@huddle.ai with any feedback/questions. View further documation of the REST API at https://docs.huddle.ai
- API version: 1.0.0
Installation
npm
Install it via:
npm install huddle_ai --save
Getting Started
Please follow the installation instruction and execute the following JS code:
var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.instance;
// Configure API key authorization
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = "YOUR API KEY"
var api = new Huddle_Ai.DefaultApi()
var parameters = {}
var parameters.email = "example@gmail.com";
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully with status:',response.statusCode);
if(response.statusCode == 200){
//print the array of people
console.log(response.body.data)
}
}
};
api.peopleGet(parameters,callback);
HuddleAi.DefaultApi
All URIs are relative to https://api.huddle.ai/api/2017_01_23
Method | HTTP request | Description |
---|---|---|
peopleCommentIdPost | POST /people/comment/{id} | Add a comment to the person |
peopleDeleteFileDelete | DELETE /people/delete/file | Delete a file associated with a person |
peopleDeletePropertyDelete | DELETE /people/delete/property | Delete a property associated with a person |
peopleGet | GET /people | Search for a person using query parameters. At least one parameter must be specified |
peoplePost | POST /people | Update a person's data |
peopleUploadFileIdPost | POST /people/upload/file/{id} | Upload file that will be associated to the person with matching id |
peopleGet
peopleGet(opts)
Search for a person using query parameters. At least one parameter must be specified
Example
var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;
// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';
var api = new Huddle_Ai.DefaultApi();
var opts = {
'email': "email_example", // String | The valid email address of the person
'first_name': "first_name_example", // String | The person's first name
'last_name': "last_name_example", // String | The person's last name
'bio': "bio_example", // String | Biography of person
'twitter': "twitter_example", // String | Twitter handle
'ethnicity': "ethnicity_example", // String | The ethnicity of the person.
'gender': "gender_example", // String | The gender of the person.
'race': "race_example", // String | The race of the person.
'tags': ["tags_example"], // [String] | The tag(s) associated with the person seperated by commas
'full_address': "full_address_example", // String | Location of person
'city': "city_example", // String | Full city name (e.g. \"New York\" not \"NYC\")
'state': "state_example", // String | Two character state code
'country': "country_example", // String | ISO 3166-1 alpha-2 two-letter country codes (http://www.nationsonline.org/oneworld/country_code_list.htm)
'social_handle': "social_handle_example", // String | Social network and social media handle seperated by colon ie twitter,twitter_handle
'social_url': "social_url_example", // String | Social network and social media url seperated by a comma ie twitter,https://twitter.com/twitter_handle
'twitter_handle': "twitter_handle_example" // String | The person's twitter handle
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully with status:',response.statusCode);
if(response.statusCode == 200){
//print the array of people
console.log(response.body.data)
}
}
};
api.peopleGet(opts, callback);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
String | The valid email address of the person | required | |
first_name | String | The person's first name | optional |
last_name | String | The person's last name | optional |
bio | String | Biography of person | optional |
String | Twitter handle | optional | |
ethnicity | String | The ethnicity of the person. | optional |
gender | String | The gender of the person. | optional |
race | String | The race of the person. | optional |
tags | String | The tag(s) associated with the person seperated by commas | optional |
full_address | String | Location of person | optional |
city | String | Full city name (e.g. \"New York\" not \"NYC\") | optional |
state | String | Two character state code | optional |
country | String | ISO 3166-1 alpha-2 two-letter country codes (http://www.nationsonline.org/oneworld/country_code_list.htm) | optional |
social_handle | String | Social network and social media handle seperated by colon ie twitter,twitter_handle | optional |
social_url | String | Social network and social media url seperated by a comma ie twitter,https://twitter.com/twitter_handle | optional |
twitter_handle | String | The person's twitter handle | optional |
Return type
Authorization
HTTP request headers
- Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
- Accept: application/json
peoplePost
People peoplePost(updateParameters)
Example
var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;
// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';
var api = new Huddle_Ai.DefaultApi();
var updateParameters = new Huddle_Ai.UpdatePerson(); // UpdatePerson | Update person parameters
updateParameters.email = "example@gmail.com";
updateParameters.bio = "CEO of Huddle AI";
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully with status:' + response.statusCode);
if(response.statusCode == 200){
//print the updated person information
console.log(response.body)
}
}
};
api.peoplePost(updateParameters, callback);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
avatar | URL | A link to the image of the person | optional |
add_alias | String | Another email address associated with the person | optional |
String | Email address of the person to update | required | |
bio | String | The person's biography | optional |
city | String | Full city name (e.g. \"New York\" not \"NYC\") | optional |
country | String | ISO 3166-1 alpha-2 two-letter country codes http://www.nationsonline.org/oneworld/country_code_list.htm | optional |
delete_tags | String | Comma seperate list of tags to delete from the person | optional |
ethnicity | String | Person's ethnicity | optional |
first_name | String | Person's first name | optional |
full_address | String | Person's full address | optional |
gender | String | Person's gender | optional |
huddle | String | Huddle data can be modified using the huddle parameter. The value is a valid JSON string with special key "Partner_URL" equal to the user's Partner URL required. Use the optional key "overwrite" to replace the existing object ie {"Partner_URL":"http://partner_url","overwrite":"true","Favorite_Movie":"Bad Boys"} | optional |
last_name | String | Person's family name | optional |
link | URL | A webstie associate with the person | optional |
race | String | Person's race | optional |
remove_alias | String | Remove email address associated with the person | optional |
social_handle | String | Social media network and handle to change seperated by a colon ie twitter,twitterhandle | optional |
social_url | String | Social media network and url to change seperated by a comma ie twitter,http://twitter.com/twitterhandle | optional |
state | String | Person's home state (For United States of America use 2 character state code) | optional |
tags | String | Comma seperate list of tags to associate with the person | optional |
website | URL | Person's personal website | optional |
Ethnicity
hispanic
non_hispanic
Gender
male
female
Race
american_indian
alaska_native
asian
black
native_hawaiian
white
Return type
Authorization
HTTP request headers
- Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
- Accept: application/json
peopleCommentIdPost
peopleCommentIdPost(id, commentParameters)
Add a comment to the person's page
Example
var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;
// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';
var api = new Huddle_Ai.DefaultApi();
var id = "id_example"; // String | The valid email address of the person you would like to comment on
var commentParameters = new HuddleAiDocumentation.CommentParameters(); // CommentParameters | Comment parameters
commentParameters.email = "example@gmail.com";
commentParameters.comment = "Hello World!";
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully with status:',response.statusCode);
}
};
api.peopleCommentPost(commentParameters, callback);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
String | The valid email address of the person you would like to comment on | required | |
comment | String | Your Comment | required |
Return type
Authorization
HTTP request headers
- Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
- Accept: application/json
peopleUploadFileIdPost
peopleUploadFileIdPost(id, file)
Upload file that will be associated to the person with matching id
Example
var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;
// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';
var api = new Huddle_Ai.DefaultApi();
var email = "example@gmail.com"; // String | The valid email address of the person you want to associate with the file
var file = "/path/to/file.txt"; // File |
var fs = require('fs');
var data = fs.createReadStream(file)
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully with status:',response.statusCode);
}
};
api.peopleUploadFileIdPost(email, data, callback);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
String | The valid email address of the person you want to associate with the file | required | |
file | File | fs ReadStream | required |
Return type
Authorization
HTTP request headers
- Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
- Accept: application/json
peopleDeleteFileDelete
peopleDeleteFileDelete(deleteParameters)
Delete a file associated with a person
Example
var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;
// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';
var api = new Huddle_Ai.DefaultApi();
var deleteParameters = new Huddle_Ai.DeleteFile(); // DeleteFile |
deleteParameters.Huddle_Ai = "File URL";
deleteParameters.email = "adrian.huddle.ai";
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully with status:',response.statusCode);
}
};
api.peopleDeleteFileDelete(deleteParameters, callback);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
String | Email address of person associated with the file | required | |
url | String | File URL | required |
Return type
Authorization
HTTP request headers
- Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
- Accept: application/json
peopleDeletePropertyDelete
peopleDeletePropertyDelete(deleteParameters)
Delete a property associated with a person
Example
var Huddle_Ai = require('huddle_ai');
var defaultClient = Huddle_Ai.ApiClient.default;
// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = 'YOUR API KEY';
var api = new Huddle_Ai.DefaultApi();
var deleteParameters = new Huddle_Ai.DeleteFile(); //
deleteParameters.Huddle_Ai = "Property File URL";
deleteParameters.email = "adrian.huddle.ai";
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
api.peopleDeletePropertyDelete(deleteParameters, callback);
Parameters
Name | Type | Description | Notes |
---|---|---|---|
String | Email address of person associated with the file | required | |
url | String | File URL | required |
Return type
Authorization
HTTP request headers
- Content-Type: application/json, application/x-www-form-Huddle_Aiencoded
- Accept: application/json
Documentation for Authorization
UserSecurity
- Type: API key
- API key parameter name: x-auth-token
- Location: HTTP header