• rohit singh 92
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 6
    Replies
i am creating a trigger using "after insert contact" event in which i want to verify the contact data with a accurateAppend api .
this api provides response in JSON format . 
but on developer console is giving an error "Callout from Triggers are currently not supported" .
i tried it to solve using @future notation .. but for @future notation the return type of function should be void .  but i want the response .. 
can anyone please guide me how to tackle this issue ?
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000kBonIAE
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000kBmIIAU
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000kBS8IAM
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000MNGPIA4
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AfDGIA0
please help me in deleting these posts..

https://developer.salesforce.com/forums/ForumsMain?id=906F0000000kBonIAE
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000kBmIIAU
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000kBS8IAM
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000MNGPIA4
i want to delete the following post please help
 https://developer.salesforce.com/forums/ForumsMain?id=906F0000000kBmIIAU
public Pagereference VerifySingleContact()
    {
        
        String SignleContactlicenseKey = '34f059d1-d6d3-4be0-a592-3ac254faa34c';
        String SignleContactVerify =  'https://api.accurateappend.com/Services/V2/AppendPhone/Residential/'+ SignleContactlicenseKey + '/?';
        String SignleContactVerifyQueryString = 'firstname='+EncodingUtil.urlEncode(firstname, 'UTF-8')+
               '&lastname='+EncodingUtil.urlEncode(lastname, 'UTF-8')+
               '&address='+EncodingUtil.urlEncode(useraddress, 'UTF-8')+
               '&city='+EncodingUtil.urlEncode(usercity, 'UTF-8')+
               '&state='+EncodingUtil.urlEncode(userstate, 'UTF-8')+
               '&postalcode='+EncodingUtil.urlEncode(userpostalcode, 'UTF-8')+
               '&source=C;D;M' +
               '&matchlevel=E1;E2;N1;N2';
        String url =  SignleContactVerify  + SignleContactVerifyQueryString ;
        String AccurateResponse;
        String log;
        //query string end
        accstoupload = new List<Contact>();
    
        // Instantiate a new http object
        Http h = new Http();
        // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
        HttpRequest req = new HttpRequest();
        req.setEndpoint(url);
        req.setMethod('GET');
        // Send the request, and return a response
        HttpResponse res = h.send(req);
        //return res.getBody();
        AccurateResponse = res.getBody();
        JSONParser parser = JSON.createParser(AccurateResponse);
        JSON2Apex jtop = JSON2Apex.parse(AccurateResponse);
        parser.nextToken();
        parser.nextValue();
        
        if(parser.getCurrentName()=='Criteria')
        {
            String PhoneList = '' ;
           // my code
            Phones = JSON.serialize(jtop.Phones);
            JSON2Apex phoneListing = (JSON2Apex)JSON.deserialize(AccurateResponse, JSON2Apex.class);
            for(Integer k = 0;k<phoneListing.Phones.size();k++)
            {
                PhoneList +=    '('+phoneListing.Phones[k].AreaCode+')'+ phoneListing.Phones[k].PhoneNumber + ',';
            }
           // my code           
                Account acc = new Account(Name = 'Robert L Knox');
                Contact a = new Contact();
                a.FirstName = firstname ;
                a.LastName = lastname ;
                a.AccountId = acc.Id;
                a.Phone = PhoneList;
                a.MailingStreet = useraddress;
                a.MailingCity = usercity;
                a.MailingState = userstate;
                a.MailingCountry = '';
                a.MailingPostalCode = userpostalcode;
                a.accurateAppendVerified__c = true;
                accstoupload.add(a);
            
            try{
              insert accstoupload;
            }
            catch (Exception e)
            {
                ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured inserting the records'+e.getMessage());
                ApexPages.addMessage(errormsg);
            }
        }else
        {
            Account acc = new Account(Name = 'Robert L Knox');
            Contact a = new Contact();
            a.FirstName = firstname ;
            a.LastName = lastname ;
            a.AccountId = a.Id;
            a.accurateAppendVerified__c = false;
            accstoupload.add(a);
        }
        
               
        return null;
    }

 
@IsTest(SeeAllData=true)
public class FileUploaderTest
{
  @isTest static void testVerifySingleUser()
  {
     FileUploader fu = new FileUploader();
     fu.firstname = 'elias';
     fu.lastname = 'yanni';
     fu.useraddress = '1013 Young Cir';
     fu.usercity = 'Corona';
     fu.userstate = 'CA';
     fu.userpostalcode = '92881';
     test.startTest();
         Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
         HttpResponse res = CalloutClass.getInfoFromExternalService();
         test.stopTest();
        // Verify response received contains fake values
        String contentType = res.getHeader('Content-Type');
        System.assert(contentType == 'application/json');
        String actualValue = res.getBody();
        String expectedValue = '{"foo":"bar"}';
        System.assertEquals(actualValue, expectedValue);
        System.assertEquals(200, res.getStatusCode());
     
  }
  static testMethod void testVerifyAccurateAppendApi()
  {
     test.startTest();
      Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
      HttpResponse res = CalloutClass.getInfoFromExternalService();
        String contentType = res.getHeader('Content-Type');
        System.assert(contentType == 'application/json');
        String actualValue = res.getBody();
        String expectedValue = '{"foo":"bar"}';
        System.assertEquals(actualValue, expectedValue);
        System.assertEquals(200, res.getStatusCode());

     test.stopTest();

  }
  static testmethod void testfileupload(){
        Test.startTest();
        PageReference pageRef = Page.helloworldpage;
        Test.setCurrentPage(pageRef);
        Account ac=new Account();ac.Name='rakuten12345';
        insert ac;
        String resourceName = 'Csvfiles';
        Document document;

        
        
        Document lstDocument = [Select id,name,Body from Document where Name ='csvContacts' ];
        Blob content= lstDocument.Body;
        String myCSVFile = lstDocument.Body.toString();
        System.debug('myCSVFile = ' + myCSVFile);
        FileUploader file=new FileUploader();
        file.contentFile = content;
        file.ReadFile(); 
        file.getuploadedAccounts();
        //file.nameFiles=content.toString();
        String nameFiles= content.toString();
        String[] filelines = nameFiles.split('\n');
        
        for(Integer i=1;i<filelines.size();i++)
        {
        String[] inputvalues = new String[]{};
        inputvalues = filelines[i].split(',');
        
                        Contact a = new Contact();
                        a.FirstName  = 'elias';
                        a.LastName = 'yanni';
                        
                        a.MailingStreet = '301 street';
                        a.MailingCity = 'Corona';
                        a.MailingState = 'CA';
                        a.MailingCountry = 'US';
                        a.MailingPostalCode = 'B12123';
                        
                        accstoupload.add(a);                
             try{
                insert accstoupload;
                System.assertEquals(1,accstoupload.size());
                Test.stopTest();
            }
            catch (Exception e)
            {
                ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template');
                ApexPages.addMessage(errormsg);
            }
        }
  }
        
        
  
  static testMethod void testgetuploadedAccounts()
  {
        test.startTest();
         FileUploader fu = new FileUploader();
         fu.ReadFile();
        test.stopTest();          
  }

}
i am using a apex class with visual force page and trying to create a package and i am getting the following error .can anyone please help how to resolve the following issue ?


Upload Failed
No test methods found in the Apex code included in the package. At least 75% test coverage is required.

following is the apex class code :
@isTest
public class FileUploader 
{
    public string nameFile{get;set;}
    public string firstName{get;set;}
    public string lastName{get;set;}
    public string userAddress{get;set;}
    public string userCity{get;set;}
    public string userState{get;set;}
    public string userPostalCode{get;set;}
    public Object Phones;
    Contact newCon {get;set;}
    public Blob contentFile{get;set;}

    String[] filelines = new String[]{};
    List<Contact> accstoupload;
    
    /***This function reads the CSV file and inserts records into the Account object. ***/
    public Pagereference ReadFile()
    {
        try{
                //Convert the uploaded file which is in BLOB format into a string
                nameFile =blobToString( contentFile,'ISO-8859-1');
                
                //Now sepatate every row of the excel file
                filelines = nameFile.split('\n');
                
                //Iterate through every line and create a Account record for each row
                accstoupload = new List<Contact>();
                for (Integer i=1;i<filelines.size();i++)
                {
                    String[] inputvalues = new String[]{};
                    String PhoneList = '' ;
                   // my code
                   Test.startTest();
                  
                    inputvalues = filelines[i].split(',');
                             String licenseKey = '34f059d1-d6d3-4be0-a592-3ac254faa34c';
                    String MultiContactVerify =  'https://api.accurateappend.com/Services/V2/AppendPhone/Residential/'+ licenseKey + '/?';
                    firstName = inputvalues[0];
                    lastName = inputvalues[1];
                    userAddress = inputvalues[2];
                    userCity = inputvalues[4];
                    userState = inputvalues[5];
                    userPostalCode = inputvalues[6];
                    String MultiAccurateResponse = getContent(firstName,
                                                              lastName,
                                                              userAddress,
                                                              userCity,
                                                              userState,
                                                              userPostalCode
                                                              );
                    
                    JSON2Apex jtop = JSON2Apex.parse(MultiAccurateResponse);
                    
                    Phones = JSON.serialize(MultiAccurateResponse);
                    
                    JSON2Apex phoneListing = (JSON2Apex)JSON.deserialize(MultiAccurateResponse, JSON2Apex.class);
                    JSONParser parser = JSON.createParser(MultiAccurateResponse);
                    
                    parser.nextToken();
                    parser.nextValue();

                    if(parser.getCurrentName()=='Criteria')
                    {

                        for(Integer k = 0;k<phoneListing.Phones.size();k++)
                        {
                            PhoneList += phoneListing.Phones[k].PhoneNumber + ',';
                            //  PhoneList += k + ',';
                        }
                        
                        Contact a = new Contact();
                        a.FirstName  = inputvalues[0];
                        a.LastName = inputvalues[1];
                        a.Phone = PhoneList;
                        a.MailingStreet = useraddress;
                        a.MailingCity = usercity;
                        a.MailingState = userstate;
                        a.MailingCountry = '';
                        a.MailingPostalCode = userpostalcode;
                        a.accurateAppendVerified__c = true;
                        accstoupload.add(a);                
                  }else
                  {
                        Contact a = new Contact();
                        a.FirstName  = inputvalues[0];
                        a.LastName = inputvalues[1];
                        a.Phone = PhoneList;
                        a.MailingStreet = useraddress;
                        a.MailingCity = usercity;
                        a.MailingState = userstate;
                        a.MailingCountry = '';
                        a.MailingPostalCode = userpostalcode;
                        a.accurateAppendVerified__c = false;
                        accstoupload.add(a);                
                  
                  }
                  Test.stopTest();
            }
                    try{
                    test.startTest();

                              insert accstoupload;
                    test.stopTest();

                    }
                    catch (Exception e)
                    {
                        ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured inserting the records'+e.getMessage());
                        ApexPages.addMessage(errormsg);
                    }
        
         }
         catch(Exception e){
                 ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured reading the CSV file'+e.getMessage());
                ApexPages.addMessage(errormsg);
         }       
        //Finally, insert the collected records
            
        return null;
    }

     public static  String getContent(String firstN,String LastN,String UserAddr,String UserCit,String UserStat,String Userpostalcod) {
         test.startTest();     
         String licenseKey = '34f059d1-d6d3-4be0-a592-3ac254faa34c';
         String MultiContactVerify =  'https://api.accurateappend.com/Services/V2/AppendPhone/Residential/'+ licenseKey + '/?';
         String MultiContactVerifyQueryString = 'firstname='+EncodingUtil.urlEncode(firstN, 'UTF-8')+
                   '&lastname='+EncodingUtil.urlEncode(LastN, 'UTF-8')+
                   '&address='+EncodingUtil.urlEncode(UserAddr, 'UTF-8')+
                   '&city='+EncodingUtil.urlEncode(UserCit, 'UTF-8')+
                   '&state='+EncodingUtil.urlEncode(UserStat, 'UTF-8')+
                   '&postalcode='+EncodingUtil.urlEncode(Userpostalcod, 'UTF-8')+
                   '&source=C;D;M' +
                   '&matchlevel=E1;E2;N1;N2';     
        String Multiurl =  MultiContactVerify + MultiContactVerifyQueryString;
        // return Multiurl ;
        //query string end
        // Instantiate a new http object
        Http h = new Http();
        // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
        HttpRequest req = new HttpRequest();
        req.setEndpoint(Multiurl);
        req.setMethod('GET');
        // Send the request, and return a response
        HttpResponse res = h.send(req);
        test.stopTest();
        return res.getBody();
    }

    /*this function is used to verify single contact*/
    public Pagereference VerifySingleContact()
    {
        test.startTest();
        String SignleContactlicenseKey = '34f059d1-d6d3-4be0-a592-3ac254faa34c';
        String SignleContactVerify =  'https://api.accurateappend.com/Services/V2/AppendPhone/Residential/'+ SignleContactlicenseKey + '/?';
        String SignleContactVerifyQueryString = 'firstname='+EncodingUtil.urlEncode(firstname, 'UTF-8')+
               '&lastname='+EncodingUtil.urlEncode(lastname, 'UTF-8')+
               '&address='+EncodingUtil.urlEncode(useraddress, 'UTF-8')+
               '&city='+EncodingUtil.urlEncode(usercity, 'UTF-8')+
               '&state='+EncodingUtil.urlEncode(userstate, 'UTF-8')+
               '&postalcode='+EncodingUtil.urlEncode(userpostalcode, 'UTF-8')+
               '&source=C;D;M' +
               '&matchlevel=E1;E2;N1;N2';
        String url =  SignleContactVerify  + SignleContactVerifyQueryString ;
        String AccurateResponse;
        String log;
        //query string end
        accstoupload = new List<Contact>();
    
        // Instantiate a new http object
        Http h = new Http();
        // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
        HttpRequest req = new HttpRequest();
        req.setEndpoint(url);
        req.setMethod('GET');
        // Send the request, and return a response
        HttpResponse res = h.send(req);
        //return res.getBody();
        AccurateResponse = res.getBody();
        JSONParser parser = JSON.createParser(AccurateResponse);
        JSON2Apex jtop = JSON2Apex.parse(AccurateResponse);
        parser.nextToken();
        parser.nextValue();
        
        if(parser.getCurrentName()=='Criteria')
        {
            String PhoneList = '' ;
           // my code
            Phones = JSON.serialize(jtop.Phones);
            JSON2Apex phoneListing = (JSON2Apex)JSON.deserialize(AccurateResponse, JSON2Apex.class);
            for(Integer k = 0;k<phoneListing.Phones.size();k++)
            {
                PhoneList +=    '('+phoneListing.Phones[k].AreaCode+')'+ phoneListing.Phones[k].PhoneNumber + ',';
            }
           // my code           
                Account acc = new Account(Name = 'Robert L Knox');
                Contact a = new Contact();
                a.FirstName = firstname ;
                a.LastName = lastname ;
                a.AccountId = a.Id;
                a.Phone = PhoneList;
                a.MailingStreet = useraddress;
                a.MailingCity = usercity;
                a.MailingState = userstate;
                a.MailingCountry = '';
                a.MailingPostalCode = userpostalcode;
                a.accurateAppendVerified__c = true;
                accstoupload.add(a);
            
            try{
              insert accstoupload;
            }
            catch (Exception e)
            {
                ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured inserting the records'+e.getMessage());
                ApexPages.addMessage(errormsg);
            }
        }else
        {
            Account acc = new Account(Name = 'Robert L Knox');
            Contact a = new Contact();
            a.FirstName = firstname ;
            a.LastName = lastname ;
            a.AccountId = a.Id;
            a.accurateAppendVerified__c = false;
            accstoupload.add(a);
        }
        
        test.stopTest();        
        return null;
    }
   
   /**** This function sends back to the visualforce page the list of account records that were inserted ****/ 
    public List<Contact> getuploadedAccounts()
    {
        if (accstoupload!= NULL)
            if (accstoupload.size() > 0)
                return accstoupload;
            else
                return null;                    
        else
            return null;
    }  
    
    /**
         This function convers the input CSV file in BLOB format into a string
        @param input    Blob data representing correct string in @inCharset encoding
        @param inCharset    encoding of the Blob data (for example 'ISO 8859-1')
     */
    public static String blobToString(Blob input, String inCharset){
    test.startTest();
        String hex = EncodingUtil.convertToHex(input);
        System.assertEquals(0, hex.length() & 1);
        final Integer bytesCount = hex.length() >> 1;
        String[] bytes = new String[bytesCount];
        for(Integer i = 0; i < bytesCount; ++i)
            bytes[i] =  hex.mid(i << 1, 2);
        test.stopTest();
        return EncodingUtil.urlDecode('%' + String.join(bytes, '%'), inCharset);
    }         
}
here is the array format 
( [Criteria] => stdClass Object ( [Host] => C1N3 [RequestDate] => 2016-05-08T19:42:59.2865950Z [RequestIP] => 182.50.78.8 [TransactionId] => 077811dd-81ce-4330-85ea-6267f109c0b2 [Address] => 1013 Young Cir [City] => Corona [FirstName] => elias [LastName] => yanni [MatchLevels] => E1;E2;N1;N2 [PostalCode] => 92881 [Sources] => C;D;M [State] => CA ) [Phones] => Array ( [0] => stdClass Object ( [AreaCode] => 714 [LineType] => LandLine [MatchLevel] => E1 [MaxValidationLevel] => E1 [PhoneNumber] => 8298032 [Source] => C ) ) )

i am trying to parse the "phones" internal variables but i am unable to parse ..i got a parser class from heroku 

public class JSON2Apex {

    public class Phones {
        public String AreaCode;
        public String LineType;
        public String MatchLevel;
        public String MaxValidationLevel;
        public String PhoneNumber;
        public String Source;
    }

    public Criteria Criteria;
    public List<Phones> Phones;

    public class Criteria {
        public String Host;
        public String RequestDate;
        public String RequestIP;
        public String TransactionId;
        public String Address;
        public String City;
        public String FirstName;
        public String LastName;
        public String MatchLevels;
        public String PostalCode;
        public String Sources;
        public String State;
    }

    
    public static JSON2Apex parse(String json) {
        return (JSON2Apex) System.JSON.deserialize(json, JSON2Apex.class);
    }
}


my syntax to parse the json "phones" internal varibale is :
 JSON2Apex jtop = JSON2Apex.parse(AccurateResponse);
jtop.Phones 

please guide me what should i do after this to get "Phones internal variable"
i am trying to append/verify the phone number saved in my phone using any salesforce .. i am developer and read about salesforce integration . but a lil confused about what way should i follow to integrate accurate append in salesforce
public Pagereference VerifySingleContact()
    {
        
        String SignleContactlicenseKey = '34f059d1-d6d3-4be0-a592-3ac254faa34c';
        String SignleContactVerify =  'https://api.accurateappend.com/Services/V2/AppendPhone/Residential/'+ SignleContactlicenseKey + '/?';
        String SignleContactVerifyQueryString = 'firstname='+EncodingUtil.urlEncode(firstname, 'UTF-8')+
               '&lastname='+EncodingUtil.urlEncode(lastname, 'UTF-8')+
               '&address='+EncodingUtil.urlEncode(useraddress, 'UTF-8')+
               '&city='+EncodingUtil.urlEncode(usercity, 'UTF-8')+
               '&state='+EncodingUtil.urlEncode(userstate, 'UTF-8')+
               '&postalcode='+EncodingUtil.urlEncode(userpostalcode, 'UTF-8')+
               '&source=C;D;M' +
               '&matchlevel=E1;E2;N1;N2';
        String url =  SignleContactVerify  + SignleContactVerifyQueryString ;
        String AccurateResponse;
        String log;
        //query string end
        accstoupload = new List<Contact>();
    
        // Instantiate a new http object
        Http h = new Http();
        // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
        HttpRequest req = new HttpRequest();
        req.setEndpoint(url);
        req.setMethod('GET');
        // Send the request, and return a response
        HttpResponse res = h.send(req);
        //return res.getBody();
        AccurateResponse = res.getBody();
        JSONParser parser = JSON.createParser(AccurateResponse);
        JSON2Apex jtop = JSON2Apex.parse(AccurateResponse);
        parser.nextToken();
        parser.nextValue();
        
        if(parser.getCurrentName()=='Criteria')
        {
            String PhoneList = '' ;
           // my code
            Phones = JSON.serialize(jtop.Phones);
            JSON2Apex phoneListing = (JSON2Apex)JSON.deserialize(AccurateResponse, JSON2Apex.class);
            for(Integer k = 0;k<phoneListing.Phones.size();k++)
            {
                PhoneList +=    '('+phoneListing.Phones[k].AreaCode+')'+ phoneListing.Phones[k].PhoneNumber + ',';
            }
           // my code           
                Account acc = new Account(Name = 'Robert L Knox');
                Contact a = new Contact();
                a.FirstName = firstname ;
                a.LastName = lastname ;
                a.AccountId = acc.Id;
                a.Phone = PhoneList;
                a.MailingStreet = useraddress;
                a.MailingCity = usercity;
                a.MailingState = userstate;
                a.MailingCountry = '';
                a.MailingPostalCode = userpostalcode;
                a.accurateAppendVerified__c = true;
                accstoupload.add(a);
            
            try{
              insert accstoupload;
            }
            catch (Exception e)
            {
                ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured inserting the records'+e.getMessage());
                ApexPages.addMessage(errormsg);
            }
        }else
        {
            Account acc = new Account(Name = 'Robert L Knox');
            Contact a = new Contact();
            a.FirstName = firstname ;
            a.LastName = lastname ;
            a.AccountId = a.Id;
            a.accurateAppendVerified__c = false;
            accstoupload.add(a);
        }
        
               
        return null;
    }

 
i am using a apex class with visual force page and trying to create a package and i am getting the following error .can anyone please help how to resolve the following issue ?


Upload Failed
No test methods found in the Apex code included in the package. At least 75% test coverage is required.

following is the apex class code :
@isTest
public class FileUploader 
{
    public string nameFile{get;set;}
    public string firstName{get;set;}
    public string lastName{get;set;}
    public string userAddress{get;set;}
    public string userCity{get;set;}
    public string userState{get;set;}
    public string userPostalCode{get;set;}
    public Object Phones;
    Contact newCon {get;set;}
    public Blob contentFile{get;set;}

    String[] filelines = new String[]{};
    List<Contact> accstoupload;
    
    /***This function reads the CSV file and inserts records into the Account object. ***/
    public Pagereference ReadFile()
    {
        try{
                //Convert the uploaded file which is in BLOB format into a string
                nameFile =blobToString( contentFile,'ISO-8859-1');
                
                //Now sepatate every row of the excel file
                filelines = nameFile.split('\n');
                
                //Iterate through every line and create a Account record for each row
                accstoupload = new List<Contact>();
                for (Integer i=1;i<filelines.size();i++)
                {
                    String[] inputvalues = new String[]{};
                    String PhoneList = '' ;
                   // my code
                   Test.startTest();
                  
                    inputvalues = filelines[i].split(',');
                             String licenseKey = '34f059d1-d6d3-4be0-a592-3ac254faa34c';
                    String MultiContactVerify =  'https://api.accurateappend.com/Services/V2/AppendPhone/Residential/'+ licenseKey + '/?';
                    firstName = inputvalues[0];
                    lastName = inputvalues[1];
                    userAddress = inputvalues[2];
                    userCity = inputvalues[4];
                    userState = inputvalues[5];
                    userPostalCode = inputvalues[6];
                    String MultiAccurateResponse = getContent(firstName,
                                                              lastName,
                                                              userAddress,
                                                              userCity,
                                                              userState,
                                                              userPostalCode
                                                              );
                    
                    JSON2Apex jtop = JSON2Apex.parse(MultiAccurateResponse);
                    
                    Phones = JSON.serialize(MultiAccurateResponse);
                    
                    JSON2Apex phoneListing = (JSON2Apex)JSON.deserialize(MultiAccurateResponse, JSON2Apex.class);
                    JSONParser parser = JSON.createParser(MultiAccurateResponse);
                    
                    parser.nextToken();
                    parser.nextValue();

                    if(parser.getCurrentName()=='Criteria')
                    {

                        for(Integer k = 0;k<phoneListing.Phones.size();k++)
                        {
                            PhoneList += phoneListing.Phones[k].PhoneNumber + ',';
                            //  PhoneList += k + ',';
                        }
                        
                        Contact a = new Contact();
                        a.FirstName  = inputvalues[0];
                        a.LastName = inputvalues[1];
                        a.Phone = PhoneList;
                        a.MailingStreet = useraddress;
                        a.MailingCity = usercity;
                        a.MailingState = userstate;
                        a.MailingCountry = '';
                        a.MailingPostalCode = userpostalcode;
                        a.accurateAppendVerified__c = true;
                        accstoupload.add(a);                
                  }else
                  {
                        Contact a = new Contact();
                        a.FirstName  = inputvalues[0];
                        a.LastName = inputvalues[1];
                        a.Phone = PhoneList;
                        a.MailingStreet = useraddress;
                        a.MailingCity = usercity;
                        a.MailingState = userstate;
                        a.MailingCountry = '';
                        a.MailingPostalCode = userpostalcode;
                        a.accurateAppendVerified__c = false;
                        accstoupload.add(a);                
                  
                  }
                  Test.stopTest();
            }
                    try{
                    test.startTest();

                              insert accstoupload;
                    test.stopTest();

                    }
                    catch (Exception e)
                    {
                        ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured inserting the records'+e.getMessage());
                        ApexPages.addMessage(errormsg);
                    }
        
         }
         catch(Exception e){
                 ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured reading the CSV file'+e.getMessage());
                ApexPages.addMessage(errormsg);
         }       
        //Finally, insert the collected records
            
        return null;
    }

     public static  String getContent(String firstN,String LastN,String UserAddr,String UserCit,String UserStat,String Userpostalcod) {
         test.startTest();     
         String licenseKey = '34f059d1-d6d3-4be0-a592-3ac254faa34c';
         String MultiContactVerify =  'https://api.accurateappend.com/Services/V2/AppendPhone/Residential/'+ licenseKey + '/?';
         String MultiContactVerifyQueryString = 'firstname='+EncodingUtil.urlEncode(firstN, 'UTF-8')+
                   '&lastname='+EncodingUtil.urlEncode(LastN, 'UTF-8')+
                   '&address='+EncodingUtil.urlEncode(UserAddr, 'UTF-8')+
                   '&city='+EncodingUtil.urlEncode(UserCit, 'UTF-8')+
                   '&state='+EncodingUtil.urlEncode(UserStat, 'UTF-8')+
                   '&postalcode='+EncodingUtil.urlEncode(Userpostalcod, 'UTF-8')+
                   '&source=C;D;M' +
                   '&matchlevel=E1;E2;N1;N2';     
        String Multiurl =  MultiContactVerify + MultiContactVerifyQueryString;
        // return Multiurl ;
        //query string end
        // Instantiate a new http object
        Http h = new Http();
        // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
        HttpRequest req = new HttpRequest();
        req.setEndpoint(Multiurl);
        req.setMethod('GET');
        // Send the request, and return a response
        HttpResponse res = h.send(req);
        test.stopTest();
        return res.getBody();
    }

    /*this function is used to verify single contact*/
    public Pagereference VerifySingleContact()
    {
        test.startTest();
        String SignleContactlicenseKey = '34f059d1-d6d3-4be0-a592-3ac254faa34c';
        String SignleContactVerify =  'https://api.accurateappend.com/Services/V2/AppendPhone/Residential/'+ SignleContactlicenseKey + '/?';
        String SignleContactVerifyQueryString = 'firstname='+EncodingUtil.urlEncode(firstname, 'UTF-8')+
               '&lastname='+EncodingUtil.urlEncode(lastname, 'UTF-8')+
               '&address='+EncodingUtil.urlEncode(useraddress, 'UTF-8')+
               '&city='+EncodingUtil.urlEncode(usercity, 'UTF-8')+
               '&state='+EncodingUtil.urlEncode(userstate, 'UTF-8')+
               '&postalcode='+EncodingUtil.urlEncode(userpostalcode, 'UTF-8')+
               '&source=C;D;M' +
               '&matchlevel=E1;E2;N1;N2';
        String url =  SignleContactVerify  + SignleContactVerifyQueryString ;
        String AccurateResponse;
        String log;
        //query string end
        accstoupload = new List<Contact>();
    
        // Instantiate a new http object
        Http h = new Http();
        // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
        HttpRequest req = new HttpRequest();
        req.setEndpoint(url);
        req.setMethod('GET');
        // Send the request, and return a response
        HttpResponse res = h.send(req);
        //return res.getBody();
        AccurateResponse = res.getBody();
        JSONParser parser = JSON.createParser(AccurateResponse);
        JSON2Apex jtop = JSON2Apex.parse(AccurateResponse);
        parser.nextToken();
        parser.nextValue();
        
        if(parser.getCurrentName()=='Criteria')
        {
            String PhoneList = '' ;
           // my code
            Phones = JSON.serialize(jtop.Phones);
            JSON2Apex phoneListing = (JSON2Apex)JSON.deserialize(AccurateResponse, JSON2Apex.class);
            for(Integer k = 0;k<phoneListing.Phones.size();k++)
            {
                PhoneList +=    '('+phoneListing.Phones[k].AreaCode+')'+ phoneListing.Phones[k].PhoneNumber + ',';
            }
           // my code           
                Account acc = new Account(Name = 'Robert L Knox');
                Contact a = new Contact();
                a.FirstName = firstname ;
                a.LastName = lastname ;
                a.AccountId = a.Id;
                a.Phone = PhoneList;
                a.MailingStreet = useraddress;
                a.MailingCity = usercity;
                a.MailingState = userstate;
                a.MailingCountry = '';
                a.MailingPostalCode = userpostalcode;
                a.accurateAppendVerified__c = true;
                accstoupload.add(a);
            
            try{
              insert accstoupload;
            }
            catch (Exception e)
            {
                ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured inserting the records'+e.getMessage());
                ApexPages.addMessage(errormsg);
            }
        }else
        {
            Account acc = new Account(Name = 'Robert L Knox');
            Contact a = new Contact();
            a.FirstName = firstname ;
            a.LastName = lastname ;
            a.AccountId = a.Id;
            a.accurateAppendVerified__c = false;
            accstoupload.add(a);
        }
        
        test.stopTest();        
        return null;
    }
   
   /**** This function sends back to the visualforce page the list of account records that were inserted ****/ 
    public List<Contact> getuploadedAccounts()
    {
        if (accstoupload!= NULL)
            if (accstoupload.size() > 0)
                return accstoupload;
            else
                return null;                    
        else
            return null;
    }  
    
    /**
         This function convers the input CSV file in BLOB format into a string
        @param input    Blob data representing correct string in @inCharset encoding
        @param inCharset    encoding of the Blob data (for example 'ISO 8859-1')
     */
    public static String blobToString(Blob input, String inCharset){
    test.startTest();
        String hex = EncodingUtil.convertToHex(input);
        System.assertEquals(0, hex.length() & 1);
        final Integer bytesCount = hex.length() >> 1;
        String[] bytes = new String[bytesCount];
        for(Integer i = 0; i < bytesCount; ++i)
            bytes[i] =  hex.mid(i << 1, 2);
        test.stopTest();
        return EncodingUtil.urlDecode('%' + String.join(bytes, '%'), inCharset);
    }         
}
i am trying to append/verify the phone number saved in my phone using any salesforce .. i am developer and read about salesforce integration . but a lil confused about what way should i follow to integrate accurate append in salesforce
hi all,

I urgently need to edit/delete a post made by me on this discussion forum...But its not allowing me to do so and pops up
saying that 'you cant delete this question as others are interested in it'.
There are no likes and no comments on it still i am unable  to delete it
Any help would be highly appreciated

Its very urgent,
Thanks,