I have an app that creates apex classes for some purposes, right now we are using Tooling Api, but some objects are not entirely accessible with it (e.g. developerName in RecordType Object). So my question is is there a way to overcome this limitation (e.g. REST API or SOAP API etc.)
-
What do you mean, exactly? You want to use one single API to create record types, apex classes, and update records, or something?– sfdcfoxMay 13, 2021 at 12:03
-
I wish to create/delete apex classes to/from org– DavidSMay 13, 2021 at 12:18
-
For what kind of org? Production? Sandbox? Developer Edition?– sfdcfoxMay 13, 2021 at 12:19
-
Sandbox........– DavidSMay 13, 2021 at 12:20
1 Answer
Generally speaking, for non-production orgs, you have several options available.
Tooling
Create
POST /services/data/vXX.X/tooling/sobjects/ApexClass
Update
PATCH /services/data/vXX.X/tooling/sobjects/ApexClass/:Id
PATCH /services/data/vXX.X/tooling/sobjects/ApexClass/Name/:Name
Delete
DELETE /services/data/vXX.X/tooling/sobjects/ApexClass/:Id
DELETE /services/data/vXX.X/tooling/sobjects/ApexClass/Name/:Name
Metadata Container
For deploying multiple ApexClass objects (and other code) in a single deployment. See the documentation for this, it is relatively complex.
REST
Create
POST /services/data/vXX.X/sobjects/ApexClass
Update
PATCH /services/data/vXX.X/sobjects/ApexClass/:Id
PATCH /services/data/vXX.X/sobjects/ApexClass/Name/:Name
Delete
DELETE /services/data/vXX.X/sobjects/ApexClass/:Id
DELETE /services/data/vXX.X/sobjects/ApexClass/Name/:Name
SOAP
Create
create(ApexClass)
Delete
delete(ApexClass)
Metadata API
Create/Update
deployMetadata(ApexClass)
Delete
deleteMetadata(ApexClass)
-
If i use REST for example must i configurate my app as a "connected app"?– DavidSMay 13, 2021 at 17:58