• Santosh Jayakar Diyyala
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hi,

In order remove duplicate records, I converted List to Set and converted same set to list. But, converted list still is giving duplicate records. Please assist.
List<Property__c> propertyList = new List<Property__c>();
	Set<Property__c> propertySet = new Set<Property__c>();
	//propertySet //unique
	
	for(Property__c prop : propertySet){		
				propertyList.add(prop);
        }
		system.debug('>>>>>propertySet'+propertySet);//unique
		system.debug('propertyList++++++'+propertyList) //duplicate records
		Database.update(propertyList,false);//duplicate id in list



Regards,
Animesh
hi everyone,

I am calling an API with Authtoken in header :
        String resp = 'response : ';
        HttpRequest req = new HttpRequest();
        JSONGenerator gen = JSON.createGenerator(false);
        JSONGenerator gen = JSON.createGenerator(false);
  		String  url = 'http://api.xxxxx.com/xx/xxx/xxx';
        
        	req.setEndpoint(url);
			String reqJSON;
                        gen.writeStartObject();
                        gen.writeStringField ('transaction_id', txnID);
                        gen.writeEndObject();
                        
                        // Get the JSON string.
                        reqJSON = gen.getAsString();        
	        req.setBody(reqJSON);
			req.setEndpoint (url);
	        req.setHeader('Authorization', 'Token xxxxxxxxxxxxxxxxxxxxxxxx');
        
                        req.setMethod ('GET');
                        req.setHeader('Content-Type', 'application/json');
                        req.setHeader('Accept', 'application/json');
                        req.setBody(reqJSON);
                        req.setTimeout(60000);
                      // Get response

        httpResponse res = new http().send(req);
		resp = resp + ' : ' + res.getBody() + ' - '  + res.toString();
	    ApexPages.addMessage(new ApexPages.Message( ApexPages.Severity.info,resp));
but the output i am able to see is this 
response : : - System.HttpResponse[Status=Moved Permanently, StatusCode=301]
​what may be the issue here ,
  • I have checked the API , its working fine on Postman and other platform.
  • I have added the api url on Remote Sites.
Is there any thing else i am missing here ?