| .. | ||
| bash_section_loading.sh | ||
| javascript_section_loading.js | ||
| python_section_loading.py | ||
| README.md | ||
Salesforce Data + Tooling API - Section-Specific Loading Examples
This directory contains working code examples demonstrating how to programmatically load only the sections you need from the enterprise (SOQL/DML sObject) and Tooling (developer record) JSON files, and how to traverse this skill's surface-specific structure.
Critical Warning
NEVER load these JSON files whole (Read, cat, whole-file JSON.parse)!
Enterprise sObjects like Account.json carry a large wsdl_segment and a
separate field_reference catalog. Loading the entire file wastes 60-80% of
tokens. Extract only the section you need.
Structure this skill exposes
assets/enterprise_api/— standard sObjects you query with SOQL and modify with DML (custom__cobjects are not included — describe the live org for those).fieldsentries carryproperties(Create/Filter/Sort/Group/Nillable/Update) plus relationship metadata (relationship_name,refers_to,relationship_type).assets/tooling_api/— developer/diagnostics records (ApexClass, TraceFlag, EntityDefinition, ...). Exposesupported_rest_api_http_methods/supported_soap_calls; queried via/services/data/vXX.0/tooling/query.fieldsvsfield_reference—field_referenceis a SEPARATE catalog, not a subset offields. System/audit fields (Id, CreatedDate, ...) frequently live ONLY infield_reference. If a field isn't infields, checkfield_referencebefore concluding it doesn't exist.
Available Examples
1. Python Example
File: python_section_loading.py
Usage:
python3 examples/python_section_loading.py
Key Pattern (respect field properties before writing SOQL):
import json
with open('assets/enterprise_api/Opportunity.json') as f:
data = json.load(f)
filterable = [n for n, m in data['fields'].items()
if 'filter' in (m.get('properties', '') or '').lower()]
2. JavaScript/Node.js Example
File: javascript_section_loading.js
Usage:
node examples/javascript_section_loading.js
3. Bash + jq Example
File: bash_section_loading.sh
Usage:
bash examples/bash_section_loading.sh
Key Pattern (check BOTH catalogs):
# Fields present ONLY in field_reference (not in fields):
jq -r '[(.field_reference | keys[]) as $k
| select((.fields | has($k)) | not) | $k][:5][]' \
assets/enterprise_api/Account.json
What every example demonstrates
- Load only the
fieldssection from an enterprise sObject - Find filterable fields (WHERE-safe) via the
propertiesstring - Traverse a relationship (
relationship_name/refers_to) - Check both
fieldsandfield_reference(dual catalog) - Read a Tooling record's
supported_rest_api_http_methods
Property → SOQL/DML capability
properties token |
Enables |
|---|---|
Filter |
WHERE clause |
Sort |
ORDER BY |
Group |
GROUP BY |
Create |
insert DML |
Update |
update DML |
Nillable |
may be null (else required on insert) |
A field without the needed token fails at runtime — verify before querying.