Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. public static Map<String, String> listGroups() {
  2. HTTPRequest req = new HttpRequest();
  3. req.setMethod('GET');
  4. req.setHeader('Accept', 'application/json');
  5. req.setEndpoint('callout:PrimaryEndpoint/');
  6. HTTPResponse res = new Http().send(req);
  7. ....
  8. }
  9.  
  10. public static Map<String, String> listUsers() {
  11. HTTPRequest req = new HttpRequest();
  12. req.setMethod('GET');
  13. req.setHeader('Accept', 'application/json');
  14. req.setEndpoint('callout:PrimaryEndpoint/users');
  15. HTTPResponse res = new Http().send(req);
  16. ....
  17. }
  18.  
  19. public static Map<String, String> listFiles() {
  20. HTTPRequest req = new HttpRequest();
  21. req.setMethod('GET');
  22. req.setHeader('Accept', 'application/json');
  23. req.setEndpoint('callout:PrimaryEndpoint/files');
  24. HTTPResponse res = new Http().send(req);
  25. ....
  26. }
  27.  
  28. public static HttpResponse doCallout(String urlPath) {
  29.  
  30. HttpRequest req = new HttpRequest();
  31. req.setMethod('GET');
  32. req.setHeader('Accept', 'application/json');
  33. req.setEndpoint('callout:PrimaryEndpoint/' + urlPath);
  34. HttpResponse res = new Http().send(req);
  35.  
  36. //do some error checking here
  37. return res;
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement