Guest User

Untitled

a guest
Jul 5th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. Http http = new Http();
  2. HttpRequest request = new HttpRequest();
  3. request.setEndpoint('http://rt4.marcura.com/REST/1.0/search/ticket/?user=salesforce&pass=salesforcepass&query=CX::Team1&format=s&fields=Subject,Queue,CF.{Account%20Name}');
  4. request.setMethod('GET');
  5. request.setTimeout(12000);
  6. HttpResponse response = http.send(request);
  7. // If the request is successful, parse the JSON response.
  8. if (response.getStatusCode() == 200) {
  9. // Deserialize the JSON string into collections of primitive data types.
  10. Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
  11. // Cast the values in the 'tickets' key as a list
  12. List<Object> tickets = (List<Object>) results.get('tickets');
  13. System.debug('Received the following tickets:');
  14. for (Object ticket: tickets) {
  15. System.debug(ticket);
  16. }
  17. }
Add Comment
Please, Sign In to add comment