API

Introduction

The Brightidea Application Programming Interface (API) allows you to access your data that was created using Brightidea On Demand Products. The API can be used for creating advanced reports to creating and updating user profiles.

Our API uses a method known as Representational State Transfer (REST). It is a simple protocol based on requesting data in the form of an HTTP request, and receiving the data back in an XML format.

Security

All sensitive information including your key is encrypted using SSL during transmission between your network and Brightidea’s. Access is protected through the use of a key we issue to you. Please contact your Account Services representative for a key.

Rate Limiting

To ensure good response time for all requests, API accounts will be limited to the amount of data they can access in a given request and hour. There is a limit on the number of rows returned from each List call and the number of calls which can be made per hour. An API call using the method bi.api.get will return the number for both of these limits. If you need to access more data from a List call than the maximum rows allowed per call from your account, be sure to use the SQL query and perform multiple calls to ensure all data is retrieved.

Encoding

All API calls will return data using UTF-8 encoding. Additionally, all user entered data (i.e. screen names, idea descriptions, etc..) will be wrapped in CDATA tags to ensure that no user entered data will disrupt the XML formatting.

Errors

If the API has encountered an error, it will return the error message in XML format. Here is an example of a possible error:

< ?xml version = “1.0” encoding=”UTF-8″?>

12345678

1

Invalid or expired BI API key.

bi.api.get
bi.api.getAffiliateList
bi.api.getAPICallList
bi.api.getPermissionList

bi.affiliate.create
bi.affiliate.get
bi.affiliate.getBlogList
bi.affiliate.getBlogCommentList
bi.affiliate.getBlogTagList
bi.affiliate.getCampaignList
bi.affiliate.getCampaignStatusList
bi.affiliate.getCategoryList
bi.affiliate.getCommunityList
bi.affiliate.getIdeaList
bi.affiliate.getIdeaChipVoteList
bi.affiliate.getIdeaCommentList
bi.affiliate.getIdeaTagList
bi.affiliate.getIdeaViewList
bi.affiliate.getIdeaVoteList
bi.affiliate.getMemberList
bi.affiliate.getMemberLoginList
bi.affiliate.getMemberTransactionList
bi.affiliate.getProjectList
bi.affiliate.getProjectStageList
bi.affiliate.getProjectStatusList
bi.affiliate.getStatusList
bi.affiliate.getTworkList
bi.affiliate.getBusinessUnitList
bi.affiliate.getEvaluationFormList
bi.affiliate.getEvaluatorList
bi.affiliate.getGroupList
bi.affiliate.getPoolList
bi.affiliate.getProposalList
bi.affiliate.getRandomIdeaList
bi.affiliate.getFile
bi.affiliate.getActionItemList

bi.affiliate.member.authenticate
bi.affiliate.member.create
bi.affiliate.member.createSession
bi.affiliate.member.getByEmail
bi.affiliate.member.getByID
bi.affiliate.member.getByEmployeeID
bi.affiliate.member.getByScreenName
bi.affiliate.member.getAccessibleAffiliateList
bi.affiliate.member.getAccessibleCampaignList
bi.affiliate.member.getBlogList
bi.affiliate.member.getBlogCommentList
bi.affiliate.member.getBlogTagList
bi.affiliate.member.getChip
bi.affiliate.member.getIdeaList
bi.affiliate.member.getIdeaChipVoteList
bi.affiliate.member.getIdeaCommentList
bi.affiliate.member.getIdeaTagList
bi.affiliate.member.getIdeaViewList
bi.affiliate.member.getIdeaVoteList
bi.affiliate.member.getLoginList
bi.affiliate.member.getTransactionList
bi.affiliate.member.getTworkList
bi.affiliate.member.update
bi.affiliate.member.getActionItemList
bi.affiliate.member.getActivityFeed
bi.affiliate.member.getNewItems
bi.affiliate.member.forgotPassword
bi.affiliate.member.getAccessibleCampaignListExtraInfo

bi.affiliate.member.transaction.get

bi.affiliate.campaign.create.basic
bi.affiliate.campaign.create.advanced
bi.affiliate.campaign.get
bi.affiliate.campaign.getBlogList
bi.affiliate.campaign.getBlogCommentList
bi.affiliate.campaign.getBlogTagList
bi.affiliate.campaign.getCategoryList
bi.affiliate.campaign.getIdeaList
bi.affiliate.campaign.getIdeaChipVoteList
bi.affiliate.campaign.getIdeaCommentList
bi.affiliate.campaign.getIdeaTagList
bi.affiliate.campaign.getIdeaViewList
bi.affiliate.campaign.getIdeaVoteList
bi.affiliate.campaign.getIdeaAttachmentList
bi.affiliate.campaign.getIdeaDetailList
bi.affiliate.campaign.getMemberTransactionList
bi.affiliate.campaign.getStatusList
bi.affiliate.campaign.addGroup
bi.affiliate.campaign.getGroupList
bi.affiliate.campaign.getEvaluationTeamList
bi.affiliate.campaign.getEvaluatorList

bi.affiliate.campaign.category.create
bi.affiliate.campaign.category.get

bi.affiliate.campaign.submissionForm.get

bi.affiliate.community.getCampaignList

bi.affiliate.status.create
bi.affiliate.status.get

bi.affiliate.twork.create
bi.affiliate.twork.get
bi.affiliate.twork.getCommentList

bi.affiliate.twork.comment.create
bi.affiliate.twork.comment.delete

bi.affiliate.twork.hifive.create

bi.affiliate.blogtopic.create
bi.affiliate.blogtopic.get
bi.affiliate.blogtopic.getBlogList

bi.affiliate.blogtopic.blog.create
bi.affiliate.blogtopic.blog.get
bi.affiliate.blogtopic.blog.getCommentList
bi.affiliate.blogtopic.blog.getTagList

bi.affiliate.campaign.idea.create
bi.affiliate.campaign.idea.update
bi.affiliate.campaign.idea.get
bi.affiliate.campaign.idea.getChipVoteList
bi.affiliate.campaign.idea.getCommentList
bi.affiliate.campaign.idea.getTagList
bi.affiliate.campaign.idea.getViewList
bi.affiliate.campaign.idea.getVoteList
bi.affiliate.campaign.idea.updateStatus
bi.affiliate.campaign.idea.getCompletedSubmissionForm
bi.affiliate.campaign.idea.getCompletedEvaluation
bi.affiliate.campaign.idea.getEvaluationFormScoreList
bi.affiliate.campaign.idea.getHistoryRecordList
bi.affiliate.campaign.idea.getPrivateCommentList
bi.affiliate.campaign.idea.getScorecardList

bi.affiliate.blogtopic.blog.comment.create
bi.affiliate.blogtopic.blog.comment.get

bi.affiliate.campaign.idea.comment.create
bi.affiliate.campaign.idea.comment.get

bi.affiliate.campaign.idea.evalutionForm.getMemberEvalutionList
bi.affiliate.campaign.idea.evaluationForm.getCompletedEvaluation

bi.affiliate.campaign.idea.evalutionForm.memberEvaluation.getCompletedEvaluation

bi.affiliate.blogtopic.blog.tag.create
bi.affiliate.blogtopic.blog.tag.get

bi.affiliate.campaign.idea.tag.create
bi.affiliate.campaign.idea.tag.get

bi.affiliate.campaign.idea.view.create

bi.affiliate.campaign.idea.chipvote.create
bi.affiliate.campaign.idea.Chipvote.clear

bi.affiliate.campaign.idea.vote.create
bi.affiliate.campaign.idea.vote.clear

bi.affiliate.getProject2List
bi.affiliate.getProject2MilestoneList
bi.affiliate.project2.getMilestoneList
bi.affiliate.getProject2ProjectionList
bi.affiliate.project2.getProjectionList
bi.affiliate.project2.getTeamMemberList
bi.affiliate.project2.getRelatedProposalList
bi.affiliate.getProject2InvestmentList
bi.affiliate.project2.getInvestmentList
bi.affiliate.getProject2ResultList
bi.affiliate.project2.getResultList
bi.affiliate.getProject2ToDoList
bi.affiliate.project2.getToDoList

bi.affiliate.evaluationTeam.getMemberList

bi.affiliate.group.addMember
bi.affiliate.group.get
bi.affiliate.group.removeMember

bi.affiliate.label.update

bi.affiliate.proposal.getRelatedIdeaList
bi.affiliate.proposal.get
bi.affiliate.proposal.getAttachmentsList
bi.affiliate.proposal.getCommentsList
bi.affiliate.proposal.getTeamList
bi.affiliate.proposal.getEvaluationList

bi.apns.unregister
bi.apns.setActiveAccount
bi.apns.enableBadgeNotification
bi.apns.resetBadgeCount

bi.api.get
Description
Returns all data for this BI API Key.
HTTP Request Method: GET
Required Permission: bi.api – Get
Arguments
none
Example Response
< ?xml version = “1.0” encoding=”UTF-8″?>

     11111111
     Active
     11/12/2008 9:21:47 AM
     
     1000
     300
Errors
Invalid or expired BI API key.
API call limit exceeded.
Permission denied.

* Note that the API_FUNCTION and API_KEY parameters may be passed as POST parameters or HTTP headers.

PHP with cURL
// Make the API call using cURL

///////////////////////////////////////////////////

$ch = curl_init();

curl_setopt($ch, CURLOPT_HTTPHEADER, array(“API_FUNCTION: bi.affiliate.getMemberList”, “API_KEY: XXXXXXXX”));

curl_setopt($ch, CURLOPT_URL, “https://na5.brightidea.com/BIP/API/api.bix?a=ODXXX”);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_POST, 0);

curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

$api_return_str = curl_exec($ch);

curl_close($ch);

// Create DOM Document

///////////////////////////////////////////////////

$doc = new DOMDocument();

$doc->loadXML($api_return_str);

// Check to see if an error was returned

///////////////////////////////////////////////////

$error = $doc->getElementsByTagName(‘ERROR’);

if($error->length > 0)

{

echo “API Error: ” . $error->item(0)->firstChild->nodeValue . ‘
’;

}

else

{

$members = $doc->getElementsByTagName(‘MEMBER’);

foreach($members as $member)

{

$id = $member->getElementsByTagName(‘ID’);

$affiliate_id = $member->getElementsByTagName(‘AFFILIATE_ID’);

$email = $member->getElementsByTagName(‘EMAIL’);

$screen_name = $member->getElementsByTagName(‘SCREEN_NAME’);

$first_name = $member->getElementsByTagName(‘FIRST_NAME’);

$last_name = $member->getElementsByTagName(‘LAST_NAME’);

$photo_url = $member->getElementsByTagName(‘PHOTO_URL’);

echo $id->item(0)->firstChild->nodeValue . ‘
’;

echo $affiliate_id->item(0)->firstChild->nodeValue . ‘
’;

echo $email->item(0)->firstChild->nodeValue . ‘
’;

echo $screen_name->item(0)->firstChild->nodeValue . ‘
’;

echo $first_name->item(0)->firstChild->nodeValue . ‘
’;

echo $last_name->item(0)->firstChild->nodeValue . ‘
’;

echo $photo_url->item(0)->firstChild->nodeValue . ‘
’;

echo ‘
’;

}

}

?>

PHP with sockets
// Define API call variables

///////////////////////////////////////////////////

$function = “bi.affiliate.getMemberList”;

$key = “XXXXXXXX”;

$affiliate = “ODXXX”;

$host = “na5.brightidea.com”; // This host much match your systems host

$port = 443;

$scheme = “ssl://”;

$api_return_str = “”;

// Define the headers for this call

///////////////////////////////////////////////////

$header = “GET /BIP/API/api.bix?a=” . urlencode($affiliate) . ” HTTP/1.1\r\n”;

$header .= “Host: $host\r\n”;

$header .= “API_KEY: $key\r\n”;

$header .= “API_FUNCTION: $function\r\n”;

$header .= “Connection: Close\r\n\r\n”;

// Open socket connection

///////////////////////////////////////////////////

$sock = fsockopen($scheme . $host, $port);

if(!$sock)

{

// Could not connect to the server

die(“The Brightidea API is unavailable at this time.”);

}

else

{

$xml_begin = false;

fwrite($sock, $header);

while(!feof($sock))

{
// Get this line

$response = fgets($sock, 1000);

// Only get XML data, exclude headers

if(strpos($response, “

$xml_begin = true;

// Append this line to the response string

if($xml_begin)

$api_return_str .= $response;

}

fclose($sock);

}

// Create DOM Object

///////////////////////////////////////////////////

$doc = new DOMDocument();

$doc->loadXML($api_return_str);

// Check to see if an error was returned

///////////////////////////////////////////////////

$error = $doc->getElementsByTagName(‘ERROR’);

if($error->length > 0)

{

echo “API Error: ” . $error->item(0)->firstChild->nodeValue . ‘
’;

}

else

{

$members = $doc->getElementsByTagName(‘MEMBER’);

foreach($members as $member)

{

$id = $member->getElementsByTagName(‘ID’);

$affiliate_id = $member->getElementsByTagName(‘AFFILIATE_ID’);

$email = $member->getElementsByTagName(‘EMAIL’);

$screen_name = $member->getElementsByTagName(‘SCREEN_NAME’);

$first_name = $member->getElementsByTagName(‘FIRST_NAME’);

$last_name = $member->getElementsByTagName(‘LAST_NAME’);

$photo_url = $member->getElementsByTagName(‘PHOTO_URL’);

echo $id->item(0)->firstChild->nodeValue . ‘
’;

echo $affiliate_id->item(0)->firstChild->nodeValue . ‘
’;

echo $email->item(0)->firstChild->nodeValue . ‘
’;

echo $screen_name->item(0)->firstChild->nodeValue . ‘
’;

echo $first_name->item(0)->firstChild->nodeValue . ‘
’;

echo $last_name->item(0)->firstChild->nodeValue . ‘
’;

echo $photo_url->item(0)->firstChild->nodeValue . ‘
’;

echo ‘
’;

}

}

?>