Table of Contents

  1.   Profile 

  1.  Mail 

  1.  Bounces 

  1.  Subscription Management 

  1.   Event Notification URL 

  1.  Filter/Apps 

  1.   Spam Reports 

  1.   Invalid Emails 

  1.   Statistics 











1. Profile


Description- This API is used to view Profile ,Edit profile ,reset password,change username or email id of an Account.

a) View Profile

b) Edit Profile

c) Reset Password

d) Change Username/Email id

Inner class-Profiledtls



 API- View Profile


Description- This API is used to view Profile Information of an Account.

i) Wrapper class-SendGrid_Profile_Api

1. Inner class-profiledtls(used for return type)

2. Method-Retrieve_Profile(string apiuser,string apikey,boolean istest)

3. Parameters-"apiuser”--> Username , “apikey”--> Password, “istest”--> for test class set to “true” else "false”

4. Return type- instance of profiledtls class

5. Example Code:-->

  [


  string apiuser='xyz.abc@gmail.com';

  string apikey='123456';

  boolean istest=false;

  sendgrid4sf.SendGrid_Profile_Api.profiledtls pfile=

  sendgrid4sf.SendGrid_Profile_Api.Retrieve_Profile(apiuser,apikey,istest);

  system.debug('=========Profile============'+pfile);

  The Output we get is---=========Profile============SendGrid_Profile_Api.profiledtls:[

  active=true, address=Sector-5, city=Gurgaon, country=IN,

  email=xyz.abc@mansasys.com, firstname=xyz, lastname=abc,

  phone=09812965891, state=Delhi, uname = xyz.abc@gmail.com,

  website=http://eventnotification-developeredition.

  ap1.force.com/, zip=null]

  ]
 API- Edit Profile


Description- This API is used to Edit Profile Information.

i) Wrapper class-SendGrid_Profile_Api


1. Inner class-profiledtls(Used as parameter)

2. Method- editprofileinfo(string apiuser,string apikey,profiledtls pfl,boolean istest)

3. Parameters-"apiuser” --> Username , “apikey”--> Password, profiledtls -->Instance of profiledtls class containing the edit information of user, “istest”--> for test class set to “true” else “false”

4. Return type- String

5. Example Code-->

  [

string apiuser='xyz.abc@gmail.com';

string apikey='123456';

boolean istest=false;

sendgrid4sf.SendGrid_Profile_Api.profiledtls editpro=new

sendgrid4sf.SendGrid_Profile_Api.profiledtls();

editpro.firstname='jkl';

string pfile=SendGrid_Profile_Api.editprofileinfo

(apiuser,apikey,editpro,istest);

system.debug('=========Profile============'+pfile);

The Output we get is either a success message or an error

message.

 ]


 API- Reset Password


Description- This API is used to Reset the Password.
i) Wrapper class-SendGrid_Profile_Api
1. Method- resetpassword(string apiuser, string apikey, string cnfpwd, string newpwd,boolean istest)
2. Parameters-"apiuser”--> Username , “apikey”--> Password, “password”-->New Password,”confirm_password”-->Confirm new password, “istest”-->
for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string password='welwel4982';
string confirm_password ='welwel4982';
String pfile= sendgrid4sf.SendGrid_Profile_Api.Resetpassword (apiuser, apikey, password, confirm_password, istest);
The Output we get is either a success message or an error message.
]

API- Change username/Email id


Description- This API is used to change Username or Email Id.
i) Wrapper class-SendGrid_Profile_Api

1. Method- UpdateUserName(string apiuser,string apikey,string uname,boolean updateusername,boolean istest)
2. Parameters-"apiuser”--> Username , “apikey”--> Password,” uname”-->New username or email id, ”updateusername”-->true to update username, false to update email ,”istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->

[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string name='abcd@gmail.com';
//string name='abcd';
//boolean updateusername=true; //to change username
boolean updateusername=false; //to change emailid
String pfile= sendgrid4sf.SendGrid_Profile_Api.UpdateUserName(
apiuser, apikey, name, updateusername, istest);
The Output we get is either a success message or an error
message.
When updateusername is set to false,an email is sent to the
user for confirmation.
]

2. Mail


Description- This API is used to send an email.
Inner class- emaildtls


 API- Send Email


Description- This API is used to send email.
i) Wrapper class-SendGrid_Mail_Api

1. Inner class-emaildtls
2. Method-sendemail(string apiuser,string apikey,emaildtls,boolean istest)
3. Parameters-"apiuser”--> Username , “apikey”--> Password, “emaildtls”-->
Instance of emaildtls class containing the email information to be
send,“istest”--> for test class set to “true” else “false”
4. Return type- String
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
sendgrid4sf.SendGrid_Mail_Api.emaildtls semail=new
sendgrid4sf.SendGrid_Mail_Api. emaildtls();
semail.toaddress=’abcd.brad@gmail.com';
semail.toname=’abc’;
semail.subject='Birthday Wishes';
//semail.text='A very Happy Birthday to you.';
semail.html='<b>Good Luck</b>';
semail.fromaddress='abc.xyz@gmail.com';
semail.fromname='ABC';
semail.xsmtpapi='Birthday';
semail.Unique_Args = 'RecordID-RecordID';
;
String response=
sendgrid4sf.SendGrid_Mail_Api.sendemail(apiuser,apikey,
semail,istest);
The Output we get is either a success message or an error
message.
]

3. Bounces


Description- This API is used to retrieve the list of bounced emails for that particular Account, not for a single category and also not for a particular date ,and also used in deleting an email from bounced list.

a) Retrieve Bounces
b) Delete Bounces
Inner class-Bouncels


 API- Retrieve Bounces



Description- This API is used to retrieve the list of bounced emails.
i) Wrapper class-SendGrid_Bounces_Api

1. Method-Retrieve_Bounces(String apiuser,String apikey,boolean istest)
2. Parameters-"apiuser”--> Username, ”apikey”--> Password, ”istest”--> for test class set to “true” else “false”
3. Return type- list<bouncels>
4. Example Code-->
  [
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
list<sendgrid4sf.SendGrid_Bounces_Api.bouncels> retbounces=sendgrid4sf.SendGrid_Bounces_Api.Retrieve_Bounces(apiuser,apikey,istest);
The Output we get is a list of bounced emails.
  ]

 API- Delete Bounces


Description- This API is used to delete a bounced email from the bounced list.
i) Wrapper class-SendGrid_Bounces_Api

1. Method- delete_bounced_emails(String apiuser,String apikey,String email,boolean istest)
2. Parameters-"apiuser”--> Username,”apikey”--> Password, “email”-->bounced email to be deleted,”istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
  [
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string email='content@brightmail.sendgrid.net';
String response=
sendgrid4sf.SendGrid_Bounces_Api.delete_bounced_emails
(apiuser, apikey,email,istest);
The Output we get is either a success message or an error message.
  ]

4. Subscription Management


Description- This API is used to retrieve unsubscribe list, deletean email or add an email from unsubscribe list.
a) Retrieve Unsubscribes
b) Delete Unsubscribes
c) Add Unsubscribes
Inner class-Unsubscribes


 API- Retrieve Unsubscribes

Description- This API is used to retrieve unsubscribed emails(delivery to those email addresses is not possible)

i) Wrapper class- SendGrid_Unsubscribe_Api

1. Inner class- Unsubscribes (Variable are-[ created-date when the email is unsubscribed, email-email id that is unsubscribed, error_msg-error messages if any while retrieving unsubscribed list] )
2. Method- Retrieve_Unsubscribe_Emails(String apiuser,String apikey,boolean istest)
3. Parameters- -"apiuser”--> Username , “apikey”--> Password, “istest”--> for test class set to “true” else “false”
4. Return type- list<Unsubscribes>
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
list< sendgrid4sf.SendGrid_Unsubscribe_Api.Unsubscribes>
retunsub=sendgrid4sf.SendGrid_Unsubscribe_Api.Retrieve_Unsubscribe_Emails(apiuser,apikey,istest);
The Output we get is a list of unsubscribed emails.
]


 API- Delete Unsubscribes

Description- This API is used to delete an unsubscribed email from the unsubscribed list.

i) Wrapper class-SendGrid_Unsubscribes_Api

1. Method- Delete_Unsubscribe_emails(String apiuser,String apikey,String email,boolean istest)
2. Parameters-"apiuser”--> Username,”apikey”--> Password, “email”-->email to be deleted from unsubscribe list,”istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string email='bodoraa.dgqeehpti@gmail.com';
String delunsub= sendgrid4sf.SendGrid_Unsubscribe_Api.
delete_Unsubscribe_emails(apiuser,apikey,email,istest);
The Output we get is a either a success message or an error message.
]

 API- Add Unsubscribes


Description- Users can add emails to their unsubscribe list in case delivery to a specific address is not desired.

i) Wrapper class-SendGrid_Unsubscribes_Api

1. Method- Add_Unsubscribe_emails(String apiuser,String apikey,String email,boolean istest)
2. Parameters-"apiuser”--> Username,”apikey”--> Password, “email”-->email to be added to unsubscribe list,”istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string email='bodoraa.dgqeehpti@gmail.com';
String addunsub= sendgrid4sf.SendGrid_Unsubscribe_Api.Add_Unsubscribe_emails apiuser,apikey,email,istest);
The Output we get is a either a success message or an error message.
]

5. Event Notification URL


Description- This API is used to update , retrieve or delete event notification url where we can get email event notifications.
a) Update/Set URL
b) Retrieve URL
c) Delete URL

 API- Update/Set URL


Description- This API is used to update or set an event notification URL where we can get email’s event notifications.

i) Wrapper class- SendGrid_EventNotificationUrl_Api

1. Method- Update_or_Set_event_notification_url (String apiuser,String apikey,String siteurl,boolean istest)
2. Parameters- -"apiuser”--> Username , “apikey”--> Password, “siteurl”-->url of that site where notifications will be send,“istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string siteurl='http://eventnotification-developeredition.
ap1.force.com/';
String seturl= sendgrid4sf.SendGrid_EventNotificationUrl_Api.Update_or_Set_event_notification_url(apiuser,apikey,siteurl,is
test);
The Output we get is a either a success message or an error message.
]

 API- Retrieve URL


Description- This API is used to retrieve event notification URL that is already set for email event notifications.

i) Wrapper class- SendGrid_EventNotificationUrl_Api

1. Method- Retrieve_event_notification_url (String apiuser,String apikey,,boolean istest)
2. Parameters-"apiuser”--> Username, ”apikey”--> Password, ”istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
String rereturl=sendgrid4sf.SendGrid_EventNotificationUrl_Api.Retrieve_event_notification_url
(apiuser,apikey,istest);
The Output we get is string containing the url of the event notification site that is set by us.
]

API- Delete URL


Description- This API is used to delete existing email event notification URL.

i) Wrapper class- SendGrid_EventNotificationUrl_Api

1. Method- Delete_event_notification_url (String apiuser,String apikey, boolean istest)
2. Parameters-"apiuser”--> Username,”apikey”--> Password,”istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
String returl=sendgrid4sf.SendGrid_EventNotificationUrl_Api.Delete_event_notification_url
(apiuser,apikey,istest);
The Output we get is a either a success message or an error message.
]

6. Filter/Apps


Description- This API is used to activate or customize an app, retrieving app settings, retrieving app list and also helps in deactivate an app.
a) Activate App
b) Customize App
c) Get Settings
d) App List
e) Deactivate App

 API- Activate App


Description- This API is used to activate an app.
Inner class-Filter_Apps


Inner class- CustomizeApp



i) Wrapper class-SendGrid_App_Api
1. Method- Activate_App(string apiuser,string apikey,string appname,Boolean istest)
2. Parameters-"apiuser”--> Username,”apikey”--> Password, “appname” -->Name of the app to be activated, ”istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string appname=’eventnotify’;
String actapp=sendgrid4sf.SendGrid_App_Api.Activate_App(apiuser,apikey,appname,istest);
The Output we get is a either a success message or an error message.
]

 API- Customize App


Description- This API is used customize an app’s fields.

i) Wrapper class-SendGrid_App_Api

1. Method- Customize_App(string apiuser, string apikey, string appname,integer processed,integer dropped,integer open,integer unsubscribe, integer deferred,integer delivered,integer bounce,integer spamreport, integer click,string siteurl, Boolean istest)
2. Parameters-"apiuser”--> Username, ”apikey”--> Password, “ appname”-->Name of the Customized app,Integer Parameters--->Give 1 to be activated, 0 to be deactivated for email notifications, “siteurl”-->Url of the site where notifications are send, ”istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string siteurl='http://eventnotification-developeredition.ap1.force.com/';
integer dropped=0;
string appname='eventnotify';
list<sendgrid4sf.SendGrid_App_Api.CustomizeApp>retapp=sendgrid4sf.SendGrid_App_Api.Customize_App
(apiuser,apikey,appname,0,dropped,1,1,1,1,1,1,1,siteurl,istest);
The Output we get is a either a success message or an error message.
]

 API- Get Settings


Description- This API is used get settings of an app’s fields.
i) Wrapper class-SendGrid_App_Api
1. Inner class- CustomizeApp
2. Method- Get_App_Settings(string apiuser,string apikey,string appname,boolean istest)
3. Parameters-"apiuser”--> Username, ”apikey”--> Password, “ appname”-->Name of the app, ”istest”--> for test class set to “true” else “false”
4. Return type- list<CustomizeApp>
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string appname='eventnotify';
list<sendgrid4sf.SendGrid_App_Api.CustomizeApp>retapp=sendgrid4sf.SendGrid_App_Api.Get_App_Settings
(apiuser,apikey,appname,istest);

The Output we get is list containing the field setting of an app.(SendGrid_App_Api.CustomizeApp:[
bounce=1, click=1, deferred=1,
delivered=1, dropped=0, open=1, processed=0, spamreport=1,
unsubscribe=1, url=http://eventnotification-developeredition.
ap1.force.com/])
]

 API- App List


Description- This API is used retrieve list of available apps.
i) Wrapper class-SendGrid_App_Api
1. Inner class- Filter_Apps
2. Method- Retrieve_App_List(string apiuser,string apikey,boolean istest)
3. Parameters-"apiuser”--> Username, ”apikey”--> Password, ”istest”--> for test class set to “true” else “false”
4. Return type- list< Filter_Apps >
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
list< sendgrid4sf.SendGrid_App_Api.Filter_Apps>retapp=sendgrid4sf.SendGrid_App_Api.Retrieve_App_List
(apiuser,apikey,istest);
The Output we get is a list containing the available apps.
==========APPLIST=========(SendGrid_App_Api.Filter_Apps:[activated=1, description=Allows you to update Twitter status through email or send direct messages to Twitter followers.,
name=twitter, title=Twitter],
SendGrid_App_Api.Filter_Apps:your gravatar to each HTML email., name=gravatar,
title=Gravatar>, SendGrid_App_Api.Filter_Apps:[activated=0,
description=Overwrites every link to track every click in
emails., name=clicktrack, title=Click Tracking],
SendGrid_App_Api.Filter_Apps:[activated=0, description=Adds
unsubscribe links to the bottom of the text and HTML emails.
Future emails wont be delivered to unsubscribed users.,
name=subscriptiontrack, title=Subscription Tracking],
SendGrid_App_Api.Filter_Apps:[activated=0, description=Appends
an invisible image to HTML emails to track emails that have
been opened., name=opentrack, title=Open Tracking],
SendGrid_App_Api.Filter_Apps:[activated=0, description=Allows
you to add a custom footer to outgoing email., name=footer,
title=Footer], SendGrid_App_Api.Filter_Apps:[activated=0,
description=Check outbound messages for spam content.,
name=spamcheck, title=Spam Checker],
SendGrid_App_Api.Filter_Apps:[activated=0, description=Track
your conversion rates and ROI with Google Analytics.,
name=ganalytics, title=Google Analytics],
SendGrid_App_Api.Filter_Apps:[activated=0, description=Allows
you to customize your outgoing HTML emails., name=template,
title=Email Template],
SendGrid_App_Api.Filter_Apps:[activated=0, description=Allows
email to be signed with DomainKeys., name=domainkeys,
title=Domain Keys], ...)
]

 API- Deactivate App


Description- This API is used to deactivate the already activated app.
i) Wrapper class-SendGrid_App_Api
1. Method- Deactivate_App(string apiuser,string apikey,string appname,boolean istest)
2. Parameters-"apiuser”--> Username, ”apikey”--> Password, “appname”-->Name of the App to be deactivated,”istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string appname=’eventnotify’;
String deactapp=sendgrid4sf.SendGrid_App_Api.Deactivate_App(apiuser, apikey,appname,istest);
The Output we get is a either a success message or an error message.
]

7. Spam Reports



Description- This API is used to retrieve and delete Spam reports.
a) Retrieve Spam Reports
b) Delete Spam Reports
Inner class-SpamReports


 API- Retrieve Spam Reports


Description- This API is used to retrieve email Id’s reporting as spams.
i) Wrapper class-SendGrid_SpamReport_Api
1. Inner class- SpamReports
2. Method- Retrieve_Spam_Emails(String apiuser,String apikey,boolean istest)
3. Parameters-"apiuser”--> Username,”apikey”--> Password, ”istest”--> for test class set to “true” else “false”
4. Return type- list<SpamReports>
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
list<sendgrid4sf.SendGrid_SpamReport_Api.SpamReports>retspam=sendgrid4sf.SendGrid_SpamReport_Api.
Retrieve_Spam_Emails(apiuser,apikey,istest);
The Output we get is a list containing emailid’s reporting spams.
]
 API- Delete Spam Reports

Description- This API is used to delete email Id reporting spams.
i) Wrapper class-SendGrid_SpamReport_Api
1. Method- Delete_Spam_emails(String apiuser,String apikey,String email,boolean istest)
2. Parameters-"apiuser”--> Username,”apikey”--> Password, “email”-->Email to be deleted from spam list, ”istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string email=’xyz@gmail.com’;
string delspam=sendgrid4sf.SendGrid_SpamReport_Api.Delete_Spam_emails(apiuser,apikey,email,istest);
The Output we get is a either a success message or an error message.
]

8. Invalid Emails


Description- This API is used to retrieve list of invalid emails and delete an invalid email from the invalid list.
a) Retrieve invalid emails
b) Delete Invalid Emails
Inner class-InvalidEmails


 API- Retrieve invalid emails


Description- This API is used to retrieve invalid email ids.
i) Wrapper class-SendGrid_ Invalid_Emails _Api
1. Inner class- InvalidEmails
2. Method- Retrieve_Invalid_Emails(String apiuser,String apikey,boolean istest)
3. Parameters-"apiuser”--> Username,”apikey”--> Password, ”istest”--> for test class set to “true” else “false”
4. Return type- list< InvalidEmails >
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
list<sendgrid4sf.SendGrid_Invalid_Emails_Api.InvalidEmails>retinval=sendgrid4sf.
SendGrid_Invalid_Emails_Api.Retrieve_Invalid_Emails(apiuser,apikey,istest);
The Output we get is a list containing invalid emailid’s.
]

 API- Delete Invalid Emails


Description- This API is used to delete invalid email Id .
i) Wrapper class-SendGrid_ Invalid_Emails _Api
1. Method- Delete_Invalid_emails(String apiuser,String apikey,String email,boolean istest)
2. Parameters-"apiuser”--> Username,”apikey”--> Password, “email”-->Email to be deleted from list of invalid emails, ”istest”--> for test class set to “true” else “false”
3. Return type- String
4. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string email='xyz@gshd.com';
String delinval=sendgrid4sf.SendGrid_Invalid_Emails_Api.Delete_Invalid_emails
(apiuser,apikey,email,istest);

The Output we get is a either a success message or a messageemail
does not exist.
]

9. Statistics


Description- This API is used to retrieve categories,retrieve aggregate statistics for a single category, also for a list of categories, retrieve category and user statistics according to start date and end date and also for a number of days including today.
a) Retrieve categories
b) Retrieve Aggregate(All time totals) statistics for a single category
c) Retrieve Aggregate(All time totals) statistics for a list of categories
d) Retrieve Category Statistics according to start date and end date
e) Retrieve Category Statistics according to days
f) Retrieve User Statistics according to start date and end date
g) Retrieve User Statistics according to days
h) Retrieve User Aggregate Statistics
Inner class-InvalidEmails



  API- Retrieve categories


Description- This API is used to retrieve category list.
i) Wrapper class-SendGrid_ Statistics_Api
1. Inner class- statistics
2. Method- Retrieve_categories(string apiuser,string apikey,boolean istest)
3. Parameters-"apiuser”--> Username,”apikey”--> Password, ”istest”--> for test
class set to “true” else “false”
4. Return type- list< String >
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
list<String>retst=sendgrid4sf.SendGrid_Statistics_Api.Retrieve_categories(apiuser,apikey,istest);
The Output we get is a list containing the categories name.
]

  API- Retrieve Aggregate(All time totals) statistics for a single category


Description- This API is used to retrieve Aggregate(All time totals) statistics for a single category.
i) Wrapper class-SendGrid_ Statistics _Api
1. Inner class- statistics
2. Method- Retrieve_category_statistics(string apiuser,string apikey,String category,boolean istest)
3. Parameters-"apiuser”--> Username, ”apikey”--> Password, “category” -->name of category for which statistics is to be retrieved, ”istest”--> for test class set to “true” else “false”
4. Return type- statistics
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string category=[select id,name from Campaign where name=
'testpromila'].Id;
sendgrid4sf.SendGrid_Statistics_Api.statistics retst=
sendgrid4sf.SendGrid_Statistics_Api.Retrieve_category_statisti
cs(apiuser,apikey,category,istest);
The Output we get is a a statistics instance containing the category information.SendGrid_Statistics_Api.statistics:[blocks=0, bounces=0,category_name=null, clicks=null, delivered=61,invalid_email=null, opens=5, r_date=null, repeat_bounces=null,repeat_spamreports=null, repeat_unsubscribes=null,requests=61, spam_report=0, unique_clicks=null,unique_opens=null, unsubscribes=0]
]

  API- Retrieve Aggregate(All time totals) statistics for a list of categories


Description- This API is used to retrieve Aggregate(All time totals) statistics for a list of categories.
i) Wrapper class-SendGrid_ Statistics _Api
1. Inner class- statistics
2. Method- Retrieve_List_of_Category_Statistics(string apiuser,string apikey,list<String>categories,boolean istest)
3. Parameters-"apiuser”--> Username, ”apikey”--> Password,“list<String>categories” --> name of category for which statistics is to be retrieved, ”istest”--> for test class set to “true” else “false”
4. Return type- list<statistics>
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
list<Lead> lamp=[select id,name from Lead where name ='xyz
abc' or name ='test abc’];
list<string> categories=new list<string>();
for(Lead c:lamp)
{
categories.add(string.valueof(c.Id));
}
list< sendgrid4sf.SendGrid_Statistics_Api.statistics> retst=
sendgrid4sf.SendGrid_Statistics_Api.Retrieve_List_of_Category_
Statistics(apiuser,apikey,categories,istest);
The Output we get is a list containing the categories
statistics.
]

  API- Retrieve Category Statistics according to start date and end date


Description- This API is used to retrieve category statistics according to start date and end date.
i) Wrapper class-SendGrid_ Statistics _Api
1. Inner class- statistics
2. Method- Retrieve_Date_statistics(string apiuser,string apikey,String category,String startdate,String enddate,boolean istest)
3. Parameters-"apiuser”--> Username, ”apikey”--> Password, “Category” -->name of category,”startdate”--> start date for retrieving statistics,“enddate”--> end date for retrieving statistics, ”istest”--> for test class set to “true” else “false”
4. Return type- list<statistics>
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string startdate='07/10/2011';
string enddate='08/10/2011';
string category=[select id,name from Lead where name='xyzboora' limit 1].Id;
list<sendgrid4sf.SendGrid_Statistics_Api.statistics>retst=sendgrid4sf.SendGrid_Statistics_Api.
Retrieve_Date_statistics(apiuser,apikey,category,startdate,enddate,istest);
The Output we get is a list containing the category statistics according to date.
]

 API- Retrieve Category Statistics according to days


Description- This API is used to retrieve category statistics according to
days.
i) Wrapper class-SendGrid_ Statistics _Api
1. Inner class- statistics
2. Method- Retrieve_Days_statistics(string apiuser,string apikey,String
category,Integer days ,boolean istest)
3. Parameters-"apiuser”--> Username, ”apikey”--> Password, “Category” -->
name of category, “days”-->No. of days for statistics, ”istest”--> for test class
set to “true” else “false”
4. Return type- list<statistics>
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
integer days=10;
list<sendgrid4sf.SendGrid_Statistics_Api.statistics> retst=sendgrid4sf.SendGrid_Statistics_Api.Retrieve_Days_statistics(apiuser,apikey,category,days,istest);
The Output we get is a list containing the category statistics according to days.
]

 API- Retrieve User Statistics according to start date and end date


Description- This API is used to retrieve User statistics according to start
date and end date.
i) Wrapper class-SendGrid_ Statistics _Api
1. Inner class- statistics
2. Method- Retrieve_Complete_Statistics_According_to_date(stringapiuser,string apikey,String startdate,String enddate,boolean istest)

For fast & friendly community support join us at GetSatisfaction | Visit our Support Page
3. Parameters-"apiuser”--> Username, ”apikey”--> Password, ”startdate”-->start date for retrieving statistics, “enddate”--> end date for retrieving statistics, ”istest”--> for test class set to “true” else “false”
4. Return type- list<statistics>
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
string startdate='07/10/2011';
string enddate='08/10/2011';
list<sendgrid4sf.SendGrid_Statistics_Api.statistics> retst=
sendgrid4sf.SendGrid_Statistics_Api.Retrieve_Complete_Statistics_According_to_date
(apiuser,apikey,startdate,enddate,istest);
The Output we get is a list containing the user statistics according to date.
]

  API- Retrieve User Statistics according to days


Description- This API is used to retrieve user statistics according to days.
i) Wrapper class-SendGrid_ Statistics _Api
1. Inner class- statistics
2. Method- Retrieve_Complete_Statistics_According_to_days(string apiuser,string apikey,Integer days ,boolean istest)
3. Parameters-"apiuser”--> Username, ”apikey”--> Password, “days”-->No. of days for statistics, ”istest”--> for test class set to “true” else “false”
4. Return type- list<statistics>
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
integer days=10;
list<sendgrid4sf.SendGrid_Statistics_Api.statistics> retst=sendgrid4sf.SendGrid_Statistics_Api.Retrieve_Complete_Statistics_According_to_days
(apiuser,apikey,days,istest);
The Output we get is a list containing the user statistics according to days.

  Retrieve User Aggregate Statistics


Description- This API is used to retrieve user aggregate statistics.
i) Wrapper class-SendGrid_ Statistics _Api
1. Inner class- statistics
2. Method- Retrieve_Total_Statistics(string apiuser,string apikey,boolean istest)
3. Parameters-"apiuser”--> Username, ”apikey”--> Password, ”istest”--> for test class set to “true” else “false”
4. Return type- statistics
5. Example Code-->
[
string apiuser='xyz.abc@gmail.com';
string apikey='123456';
boolean istest=false;
sendgrid4sf.SendGrid_Statistics_Api.statistics retst=
sendgrid4sf.SendGrid_Statistics_Api.Retrieve_Total_Statistics(
apiuser,apikey,istest);
The Output we get is a statistics object containing the complete statistics information of user.
]