Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @InvocableMethod(Label ='Do Callout' description='does a callout')
- public static List<String> DoCallout(List<String> input){
- String city = input.get(0);
- Http http = new Http();
- HttpRequest request = new HttpRequest();
- request.setEndpoint('https://api.openweathermap.org/data/2.5/weather?q='+city+'&APPID=67fc7cb50b5b109eb50966923d8e4fcc');
- request.setMethod('GET');
- HttpResponse response = http.send(request);
- if (response.getStatusCode() == 200) {
- Map<String, Object> results = (Map<String, Object>)
- JSON.deserializeUntyped(response.getBody());
- List<Object> animals = (List<Object>) results.get();
- return animals;
- }
- return new List<String> {'Test'};
- }
Add Comment
Please, Sign In to add comment