function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
asadim2asadim2 

​Query using Tooling API: sObject type 'Account' is not supported

Running the following query in Developer Console using Tooling API fails.
SELECT Id FROM Account WHERE id = '000000000000000'

Error: sObject type 'Account' is not supported.

Same query runs fine without the Tooling API. I am the System Admin in a Developer Edition org. Any ideas? Thanks.
Best Answer chosen by asadim2
Amit Chaudhary 8Amit Chaudhary 8
Hi Asadim,

Tooling API facilitates the development of any organization-based user interface or user experience that requires create, read, update, or delete operations to Salesforce metadata. By contrast, Metadata API facilitates the migration of Salesforce metadata from one organization to another

What Does Tooling API Do?
1) Manage working copies of Apex classes and triggers and Visualforce pages and components.
2) Check for updates and errors in working copies of Apex classes and triggers and Visualforce pages and components and commit changes to your organization.
3) Set heap dump markers.
4) Overlay Apex code or SOQL statements on an Apex execution and view detailed debug log and heap dump information.
5) Set trace flags and generate log files for yourself or for other users.
6) Access debug log and heap dump files.
7) Manage custom fields on custom objects.

Please check below post for more detail on tooling API.
https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_tasks.htm

You can try below Tooling API call in developer Console
SELECT Id, name FROM Apexclass
User-added image

https://developer.salesforce.com/blogs/developer-relations/2013/01/new-in-spring-13-the-tooling-api.html

Yes Account is not Supported :-
/services/data/v28.0/tooling/query/?q=select+id,Name+from+Account+limit+1
[
   {  
      "message" : "sObject type 'Account' is not supported.",
      "errorCode" : "INVALID_TYPE"
   }
]
User-added image

I hope this will help you. Please let us know if this will help you.

Thanks,
Amit Chaudhary

All Answers

Vinnie BaconVinnie Bacon
This query looks fine.  I ran it in my org and it didn't produce any errors.  (Nor results of course.)

The only thing I can think of is the user running the query doesn't have access to the Account object.
Prabhat Kumar12Prabhat Kumar12
Hi,
It seems you are using query in developer console with "Use Tooling API" Checked bottom on the screen. If you uncheck that your query will work fine. As it is working fine in my ORG.

With "Use Tooling API" Checked - You can query Name of Apex class, Triggers, Coverage of the code.

Just run following query and it will give the Class name with ID.
 
SELECT Id, name FROM Apexclass
Hope this will help you !!

Please mark this as answer if it works for you.


 
asadim2asadim2
Did you run it using Tooling API in Developer Console?
Prabhat Kumar12Prabhat Kumar12
Yes... I ran this.
Amit Chaudhary 8Amit Chaudhary 8
Hi Asadim,

Tooling API facilitates the development of any organization-based user interface or user experience that requires create, read, update, or delete operations to Salesforce metadata. By contrast, Metadata API facilitates the migration of Salesforce metadata from one organization to another

What Does Tooling API Do?
1) Manage working copies of Apex classes and triggers and Visualforce pages and components.
2) Check for updates and errors in working copies of Apex classes and triggers and Visualforce pages and components and commit changes to your organization.
3) Set heap dump markers.
4) Overlay Apex code or SOQL statements on an Apex execution and view detailed debug log and heap dump information.
5) Set trace flags and generate log files for yourself or for other users.
6) Access debug log and heap dump files.
7) Manage custom fields on custom objects.

Please check below post for more detail on tooling API.
https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_tasks.htm

You can try below Tooling API call in developer Console
SELECT Id, name FROM Apexclass
User-added image

https://developer.salesforce.com/blogs/developer-relations/2013/01/new-in-spring-13-the-tooling-api.html

Yes Account is not Supported :-
/services/data/v28.0/tooling/query/?q=select+id,Name+from+Account+limit+1
[
   {  
      "message" : "sObject type 'Account' is not supported.",
      "errorCode" : "INVALID_TYPE"
   }
]
User-added image

I hope this will help you. Please let us know if this will help you.

Thanks,
Amit Chaudhary
This was selected as the best answer