Skip to main content
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;

...

 
32 answers
  1. Dec 22, 2015, 4:54 AM
    You don't have to create a separate Class or a Map. 

    Below please find my working code, and be careful with the lower case for contacts.

     

    @RestResource(urlMapping='/Accounts/*/contacts')

    global class AccountManager {

    @HttpGet

    global static Account getAccount() {

    RestRequest req = RestContext.request;

    String accId = req.requestURI.substringBetween('Accounts/', '/contacts');

    Account acc = [SELECT Id, Name, (SELECT Id, Name FROM Contacts)

    FROM Account WHERE Id = :accId];

    return acc;

    }

    }

     
0/9000