Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string getData(){
- Http p = new Http();
- HttpRequest request = new HttpRequest();
- HttpResponse response = new HttpResponse();
- IntegrationUser__c sf = [SELECT Id, Name, password__c, client_id__c, client_secret__c, endpoint__c, method__c, grant_type__c FROM IntegrationUser__c limit 1];
- request.setMethod(sf.method__c);
- request.setEndpoint(sf.endpoint__c);
- string body = 'grant_type='+sf.grant_type__c;
- body = body+'&client_id='+sf.client_id__c;
- body = body+'&client_secret='+sf.client_secret__c;
- body = body+'&username='+sf.Name;
- body = body+'&password='+sf.password__c;
- request.setBody(body);
- response = p.send(request);
- System.debug(body);
- system.debug(response.getBody());
- result = response.getBody();
- return result;
- }
Add Comment
Please, Sign In to add comment