Home360Aristotle 360 APICreating Entities and Transactions Using the API

93.3. Creating Entities and Transactions Using the API

All "set web services" take the same data structure that the "get web service" uses. Also, when you pass in a Random GUID to the get web service, it will return you an empty data set with all the structure you need to save a new record.  

The other part that is missing is that there is a parameter on the getReceiptInfo called: strReceiptFromType. This parameter accepts the following values: "INDIVIDUAL", "LEGISLATOR", "COMPANY", "POLITICALCOMMITTEE". Note that casing does not matter but politicalcommittee has to be spelled without a space between political and committee.

Let's say you want to save a new Receipt to an Existing individual, the code would look like the following:

//Get All Individuals With "Williams in their Name"

getIndivdiualInfoWS.getIndividualInformationWebService getIndindividual = new getIndivdiualInfoWS.getIndividualInformationWebService();
DataSet dsResult = getIndindividual.searchKeyword("Williams", UserName, Password) ;
 
//Take GUID from First Individual From Result List:
DataRow drwFirst = dsResult.Tables["std_Individual"].Rows[0] ;

String strFirstIndividualGUID = drwFirst["ind_GUID"].toString();

 

//ADD New Receipt to Individual Above

String strRandomReceiptGUID = System.Guid.NewGUID().toString();

DataSet dsNewReceipt =  getTransactionInfoWS.getReceiptDetail(strRandomReceiptGUID, strFirstIndividualGUID, "INDIVIDUAL");

 

//Create New Receipt Row:

DataRow drwNewReceipt = dsNewReceipt.Tables["std_Receipt"].newRow();

 

//Edit your receipt:

drwNewReceipt["rcp_GUID"] = System.Guid.NewGUID().toString();

drwNewReceipt["rcp_Amount"] = 200.00 ;

drwNewReceipt["rcp_Date"] = "01/01/2010";

drwNewReceipt["rcp_Deleted"] = 0;

drwNewReceipt["rcp_CreatedOn"] = "01/01/2010";

drwNewReceipt["rcp_CreatedBy"] = System.Guid.NewGUID().toString();

 

//Add New Row back to Receipt Dataset:

dsNewReceipt.Tables["std_Receipt"].Rows.Add(drwNewReceipt);

 

//Call SetReceiptDetail Web Service to save new Receipt to Database:

setTransactionInfoWS.setReceiptDetail(dsNewReceipt);

 


For review:

To Update an Existing Entity: 

1.       Call get Web Service with known Entity's GUID

2.       Edit the Returned Dataset

3.       Call set Web Service


To Create a new Entity: 

1.       Call get Web Service with Random New GUID

2.       Add New Row to Dataset Returned by Web Service

3.       Call set Web Service

This page was: Helpful | Not Helpful