• Philippe Simoes
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
the question in the challenge is:The method must return the ID and Name for the requested record and all associated contacts with their ID and Name.

but ppl have passed the trailhead by using similar code:
Account result =  [Select Id,Name ,(Select Id, Name From Contacts) From Account where Id = :accId];
        return result;

When i put this in the execute anonymous window:-
Account result =  [Select Id,Name ,(Select Id, Name From Contacts) From Account where Id = '00128000005ee4zAAA'];
system.debug(result);

I get only the account id i do not get the contact ids related to it.
How to go about doing it?
Please help. 
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;
...