Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexed1/b178917a395acb341e0be3143a692278 to your computer and use it in GitHub Desktop.
Save alexed1/b178917a395acb341e0be3143a692278 to your computer and use it in GitHub Desktop.
global with sharing class GetProducts {
@InvocableMethod
public static List<Results> getProducts(List<Requests> requests)
{
Http http = new Http();
HttpRequest request = new HttpRequest();
String endpoint = requests[0].endpointURL;
System.debug('endpoint is: ' + endpoint);
request.setEndpoint(endpoint);
request.setMethod('GET');
HttpResponse response = http.send(request);
Results curResult = new Results();
curResult.responseJSON = response.getBody();
List<Results> resultsList = new List<Results>();
resultsList.add(curResult);
return resultsList;
}
global class Requests {
@InvocableVariable
global String endpointURL;
}
global class Results {
@InvocableVariable
global String responseJSON;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment