GetCredits

Description

Gets credits

Signature
PanelistCredit[] GetCredits(string key, string panelId, int panelistId, string surveyId, int topN, int startPosition, bool orderAscending, DateTime fromDate, DateTime toDate, DatabaseType databaseType)

Parameters

Name Data Type Description

key

string required

The authentication key

panelId

string required

The panel ID

surveyId

string required

The survey ID

topN

int required

The number of credits to return

startPosition

int required

The creditId from where to start

orderAscending

bool required

Sort credits ascending/descending

fromDate

DateTime required

Specifies the from DateTime (including) when the credit was added. If you do not want to use from date, use DateTime.MinValue. The parameter will then be ignored in the whereclause.

toDate

DateTime required

Specifies the to DateTime (including) when the credit was added. If you do not want to use from date, use DateTime.MinValue. The parameter will then be ignored in the whereclause.

databaseType

DatabaseType required

Production or Test.

Response

Data Type Description

A collection of credits.

Example

//***************************************************
//
// Get credits
//
//***************************************************

// Create instance of the webservice
PanelCreditSoapClient panelCredit = new PanelCreditSoapClient();

// NOTE: Credits will not be available if the respondent has not completed the spesific survey

// Example: How to find TopN credits
// To find topN credits we must first find which creditId to use as startpositon.
// CreditId is a unique identifier for all credits in a panel.
// Find creditId for the second (index=1) added credit:
PanelistCredit[] panelistCreditsAll = panelCredit.GetAllCreditsFromPanelist(key, panelId, panelistId, DatabaseType.Production);
creditId = panelistCreditsAll[1].CreditId;
startPosition = creditId;

// To get the TopN last credits, we must order descending
orderAscending = false;

// Specify how many credits to return
topN = 2;

// Set fromDate to seven days back from today
fromDate = DateTime.Now.Subtract(new TimeSpan(7,0,0,0));

// Set toDate to yesterday
toDate = DateTime.Now.Subtract(new TimeSpan(1,0,0,0));

// Get credits
PanelistCredit[] credits =  panelCredit.GetCredits(key, panelId, panelistId, surveyId, topN, startPosition, orderAscending, fromDate, toDate, DatabaseType.Production);