Write a SOQL query to fetch all active ValidationRule or CustomField metadata records using the Tooling API query structure.
Answer
Metadata objects such as ValidationRule and CustomField are queried through the Tooling API (/services/data/vXX.0/tooling/query/?q=...), not the standard query endpoint.
soql
SELECT Id, ValidationName, Active, EntityDefinition.QualifiedApiName FROM ValidationRule WHERE Active = true
SELECT Id, DeveloperName, TableEnumOrId FROM CustomField
Only ValidationRule has an Active flag; CustomField records are queried by name or object (there is no 'active' state for fields).
soqlscenariotooling-apimetadata