Created
May 27, 2019 23:24
-
-
Save alexed1/b178917a395acb341e0be3143a692278 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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