-
ChatterFeed
-
0Best Answers
-
2Likes Received
-
1Likes Given
-
1Questions
-
3Replies
HTTP and Basic Callout Trailhead Challange
Hello,
I am trying to solve the challange of the HTTP and Basic Callout module of Salesforce trailhead and I am having some queries in which you could point to the right direction:
1- The challange asked us to call this URL https://th-apex-http-callout.herokuapp.com/animals/:id in method getAnimalNameById... should that URL be in this form instead of the above https://th-apex-http-callout.herokuapp.com/animals?id ? Where id is a parameter in the URL.
2- When I tried to check the solution of the challange, Salesforce generated that error for me
"Challenge Not yet complete... here's what's wrong:
Executing the 'getAnimalNameById' method on 'AnimalLocator' failed. Make sure the method exists with the name 'getAnimalNameById', is public and static, accepts an Integer and returns a String."
despite that my class implementation has this method declared as public static String as below in the code snippet:
I would appreciate your help in this post.
Thank you,
Sinan
I am trying to solve the challange of the HTTP and Basic Callout module of Salesforce trailhead and I am having some queries in which you could point to the right direction:
1- The challange asked us to call this URL https://th-apex-http-callout.herokuapp.com/animals/:id in method getAnimalNameById... should that URL be in this form instead of the above https://th-apex-http-callout.herokuapp.com/animals?id ? Where id is a parameter in the URL.
2- When I tried to check the solution of the challange, Salesforce generated that error for me
"Challenge Not yet complete... here's what's wrong:
Executing the 'getAnimalNameById' method on 'AnimalLocator' failed. Make sure the method exists with the name 'getAnimalNameById', is public and static, accepts an Integer and returns a String."
despite that my class implementation has this method declared as public static String as below in the code snippet:
public class AnimalLocator { public static String getAnimalNameById(Integer id) { Http http = new Http(); HttpRequest request = new HttpRequest(); request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals?id'); request.setMethod('GET'); HttpResponse response = http.send(request); List<Object> animals = NULL; String returnValue = NULL; // if the request was successful, then parse the JSON response if (response.getStatusCode() == 200) { Map<String, Object> result = (Map<String, Object>) JSON.deserializeUntyped(response.getBody()); animals = (List<Object>) result.get('animals'); System.debug(animals); } if (animals.size() > 0 && animals != NULL && id < animals.size()) { returnValue = (String) animals.get(id); } return returnValue; } // end getAnimalNameById method } // end AnimalLocator class
I would appreciate your help in this post.
Thank you,
Sinan
-
- SinanBunni
- December 20, 2015
- Like
- 2
- Continue reading or reply
HTTP and Basic Callout Trailhead Challange
Hello,
I am trying to solve the challange of the HTTP and Basic Callout module of Salesforce trailhead and I am having some queries in which you could point to the right direction:
1- The challange asked us to call this URL https://th-apex-http-callout.herokuapp.com/animals/:id in method getAnimalNameById... should that URL be in this form instead of the above https://th-apex-http-callout.herokuapp.com/animals?id ? Where id is a parameter in the URL.
2- When I tried to check the solution of the challange, Salesforce generated that error for me
"Challenge Not yet complete... here's what's wrong:
Executing the 'getAnimalNameById' method on 'AnimalLocator' failed. Make sure the method exists with the name 'getAnimalNameById', is public and static, accepts an Integer and returns a String."
despite that my class implementation has this method declared as public static String as below in the code snippet:
I would appreciate your help in this post.
Thank you,
Sinan
I am trying to solve the challange of the HTTP and Basic Callout module of Salesforce trailhead and I am having some queries in which you could point to the right direction:
1- The challange asked us to call this URL https://th-apex-http-callout.herokuapp.com/animals/:id in method getAnimalNameById... should that URL be in this form instead of the above https://th-apex-http-callout.herokuapp.com/animals?id ? Where id is a parameter in the URL.
2- When I tried to check the solution of the challange, Salesforce generated that error for me
"Challenge Not yet complete... here's what's wrong:
Executing the 'getAnimalNameById' method on 'AnimalLocator' failed. Make sure the method exists with the name 'getAnimalNameById', is public and static, accepts an Integer and returns a String."
despite that my class implementation has this method declared as public static String as below in the code snippet:
public class AnimalLocator { public static String getAnimalNameById(Integer id) { Http http = new Http(); HttpRequest request = new HttpRequest(); request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals?id'); request.setMethod('GET'); HttpResponse response = http.send(request); List<Object> animals = NULL; String returnValue = NULL; // if the request was successful, then parse the JSON response if (response.getStatusCode() == 200) { Map<String, Object> result = (Map<String, Object>) JSON.deserializeUntyped(response.getBody()); animals = (List<Object>) result.get('animals'); System.debug(animals); } if (animals.size() > 0 && animals != NULL && id < animals.size()) { returnValue = (String) animals.get(id); } return returnValue; } // end getAnimalNameById method } // end AnimalLocator class
I would appreciate your help in this post.
Thank you,
Sinan
-
- SinanBunni
- December 20, 2015
- Like
- 2
- Continue reading or reply
Unable to validate AccountManager APEX Web Service Trailhead Challenge
I've completed the challenge, it has 100% coverage. I've checked all the method names. The URL is valid. I've used Work Bench and curl to test and even tested with multiple Accounts with and without contacts.
I know on other challenges, punctionation was important. What about the defination of the return? Are there expected names?
I built a class to hold Account ID & Name along with a List of Contact names and IDs. Is this my issue? Anyone else have a challenge with this challenge?
Any help or hints will be appreciated.
Here are snippets of my code:
@RestResource(urlMapping='/Accounts/*/contacts')
global with sharing class AccountManager {
....
global class APIAccount {
public ID Id;
public String Name;
List<APIContact> Contacts;
...
@HttpGet
global static APIAccount getAccount() {
RestRequest request = RestContext.request;
...
I know on other challenges, punctionation was important. What about the defination of the return? Are there expected names?
I built a class to hold Account ID & Name along with a List of Contact names and IDs. Is this my issue? Anyone else have a challenge with this challenge?
Any help or hints will be appreciated.
Here are snippets of my code:
@RestResource(urlMapping='/Accounts/*/contacts')
global with sharing class AccountManager {
....
global class APIAccount {
public ID Id;
public String Name;
List<APIContact> Contacts;
...
@HttpGet
global static APIAccount getAccount() {
RestRequest request = RestContext.request;
...
- John Lay 9
- December 21, 2015
- Like
- 1
- Continue reading or reply
HTTP and Basic Callout Trailhead Challange
Hello,
I am trying to solve the challange of the HTTP and Basic Callout module of Salesforce trailhead and I am having some queries in which you could point to the right direction:
1- The challange asked us to call this URL https://th-apex-http-callout.herokuapp.com/animals/:id in method getAnimalNameById... should that URL be in this form instead of the above https://th-apex-http-callout.herokuapp.com/animals?id ? Where id is a parameter in the URL.
2- When I tried to check the solution of the challange, Salesforce generated that error for me
"Challenge Not yet complete... here's what's wrong:
Executing the 'getAnimalNameById' method on 'AnimalLocator' failed. Make sure the method exists with the name 'getAnimalNameById', is public and static, accepts an Integer and returns a String."
despite that my class implementation has this method declared as public static String as below in the code snippet:
I would appreciate your help in this post.
Thank you,
Sinan
I am trying to solve the challange of the HTTP and Basic Callout module of Salesforce trailhead and I am having some queries in which you could point to the right direction:
1- The challange asked us to call this URL https://th-apex-http-callout.herokuapp.com/animals/:id in method getAnimalNameById... should that URL be in this form instead of the above https://th-apex-http-callout.herokuapp.com/animals?id ? Where id is a parameter in the URL.
2- When I tried to check the solution of the challange, Salesforce generated that error for me
"Challenge Not yet complete... here's what's wrong:
Executing the 'getAnimalNameById' method on 'AnimalLocator' failed. Make sure the method exists with the name 'getAnimalNameById', is public and static, accepts an Integer and returns a String."
despite that my class implementation has this method declared as public static String as below in the code snippet:
public class AnimalLocator { public static String getAnimalNameById(Integer id) { Http http = new Http(); HttpRequest request = new HttpRequest(); request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals?id'); request.setMethod('GET'); HttpResponse response = http.send(request); List<Object> animals = NULL; String returnValue = NULL; // if the request was successful, then parse the JSON response if (response.getStatusCode() == 200) { Map<String, Object> result = (Map<String, Object>) JSON.deserializeUntyped(response.getBody()); animals = (List<Object>) result.get('animals'); System.debug(animals); } if (animals.size() > 0 && animals != NULL && id < animals.size()) { returnValue = (String) animals.get(id); } return returnValue; } // end getAnimalNameById method } // end AnimalLocator class
I would appreciate your help in this post.
Thank you,
Sinan
- SinanBunni
- December 20, 2015
- Like
- 2
- Continue reading or reply
Unable to validate AccountManager APEX Web Service Trailhead Challenge
I've completed the challenge, it has 100% coverage. I've checked all the method names. The URL is valid. I've used Work Bench and curl to test and even tested with multiple Accounts with and without contacts.
I know on other challenges, punctionation was important. What about the defination of the return? Are there expected names?
I built a class to hold Account ID & Name along with a List of Contact names and IDs. Is this my issue? Anyone else have a challenge with this challenge?
Any help or hints will be appreciated.
Here are snippets of my code:
@RestResource(urlMapping='/Accounts/*/contacts')
global with sharing class AccountManager {
....
global class APIAccount {
public ID Id;
public String Name;
List<APIContact> Contacts;
...
@HttpGet
global static APIAccount getAccount() {
RestRequest request = RestContext.request;
...
I know on other challenges, punctionation was important. What about the defination of the return? Are there expected names?
I built a class to hold Account ID & Name along with a List of Contact names and IDs. Is this my issue? Anyone else have a challenge with this challenge?
Any help or hints will be appreciated.
Here are snippets of my code:
@RestResource(urlMapping='/Accounts/*/contacts')
global with sharing class AccountManager {
....
global class APIAccount {
public ID Id;
public String Name;
List<APIContact> Contacts;
...
@HttpGet
global static APIAccount getAccount() {
RestRequest request = RestContext.request;
...
- John Lay 9
- December 21, 2015
- Like
- 1
- Continue reading or reply