Guest User

Untitled

a guest
Jan 9th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. public string getData(){
  2. Http p = new Http();
  3. HttpRequest request = new HttpRequest();
  4. HttpResponse response = new HttpResponse();
  5. 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];
  6. request.setMethod(sf.method__c);
  7. request.setEndpoint(sf.endpoint__c);
  8. string body = 'grant_type='+sf.grant_type__c;
  9. body = body+'&client_id='+sf.client_id__c;
  10. body = body+'&client_secret='+sf.client_secret__c;
  11. body = body+'&username='+sf.Name;
  12. body = body+'&password='+sf.password__c;
  13. request.setBody(body);
  14. response = p.send(request);
  15. System.debug(body);
  16. system.debug(response.getBody());
  17. result = response.getBody();
  18.  
  19.  
  20. return result;
  21. }
Add Comment
Please, Sign In to add comment