Given a list of Account ID's, I want to get all assets associated with them.

So far, I worked out I can get the account by calling :


Seems simply enough. However this object does not contain assets (Or even Asset ID's) in the response.

I then called


In the hope that this would give me more info on how to get the assets associated with an account. It does infact return some documentation on possible ways to get individual assets.


But the {ID} is infact the AssetID, not the AccountID.

Is there any way, given an accountID, to get all assets associated with them via REST (Not SOAP, SOQL etc).


You can execute SOQL via the REST API:


Just for fun completeness, it is nigh trivial to use Apex REST and be truly RESTful. Better to avoid Apex though, as you indicate is your intention.

global class AccountAsset
    global static List<Asset> getChildren()
        return [
            SELECT Name FROM Asset WHERE AccountId = 


  • Not reeaalllyyy RESTful though is it :). But it works! Thanks! Jun 2 '16 at 23:28
  • Ha good point. Well, you could make it truly RESTful by writing a @RestResource via Apex, but not worth the trouble unless you're really a purist.
    – Adrian Larson
    Jun 2 '16 at 23:30
  • @Mind technically one-line-able: @RestResource(urlMapping='/AssetsByAccount/*') global class AccountAsset{@HttpGet global static List<Asset> getChildren(){return [SELECT Name FROM Asset WHERE AccountId =:RestContext.request.requestUri.substringAfterLast('/')];}}
    – Adrian Larson
    Jun 3 '16 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.