You need to sign in to do that
Don't have an account?
S S Malik
Line: 13, Column: 22 Loop must iterate over a collection type: String(API integration starting issues)
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://www.itutorlms.com/test.php');
request.setMethod('GET');
HttpResponse response = http.send(request);
// If the request is successful, parse the JSON response.
if (response.getStatusCode() == 200) {
// Deserialize the JSON string into collections of primitive data types.
Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
// Cast the values in the 'Name' key as a list
List<String> names = (List<String>) results.get('names');
System.debug('Received the following names:');
for(Object name :'names')
{
System.debug(name);
}
}
HttpRequest request = new HttpRequest();
request.setEndpoint('https://www.itutorlms.com/test.php');
request.setMethod('GET');
HttpResponse response = http.send(request);
// If the request is successful, parse the JSON response.
if (response.getStatusCode() == 200) {
// Deserialize the JSON string into collections of primitive data types.
Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
// Cast the values in the 'Name' key as a list
List<String> names = (List<String>) results.get('names');
System.debug('Received the following names:');
for(Object name :'names')
{
System.debug(name);
}
}
All Answers
try this Thanks
i hop its helps you Mark it best answer if it helps you :)
Thank for quick reply but its gives this error
i had done this practice already but could not solve this
System.NullPointerException: Attempt to de-reference a null object