3

Basically I'm trying to retrieve the SandboxInfo records of my organization, but I can't seem to find the correct endpoint for that.

I've tried executing /services/data/v41.0/tooling/sobjects/SandboxInfo and that gives me the following response:

{
    "objectDescribe": {
        "activateable": false,
        "createable": true,
        "custom": false,
        "customSetting": false,
        "deletable": true,
        "deprecatedAndHidden": false,
        "feedEnabled": false,
        "hasSubtypes": false,
        "isSubtype": false,
        "keyPrefix": "0GQ",
        "label": "Sandbox Info",
        "labelPlural": "Sandbox Infos",
        "layoutable": false,
        "mergeable": false,
        "mruEnabled": false,
        "name": "SandboxInfo",
        "queryable": true,
        "replicateable": false,
        "retrieveable": true,
        "searchable": false,
        "triggerable": false,
        "undeletable": false,
        "updateable": true,
        "urls": {
            "rowTemplate": "/services/data/v41.0/tooling/sobjects/SandboxInfo/{ID}",
            "defaultValues": "/services/data/v41.0/tooling/sobjects/SandboxInfo/defaultValues?recordTypeId&fields",
            "describe": "/services/data/v41.0/tooling/sobjects/SandboxInfo/describe",
            "sobject": "/services/data/v41.0/tooling/sobjects/SandboxInfo"
        }
    },
    "recentItems": []
}

The thing is the urls that come in the response don't allow me to GET all the available SandboxInfo elements, but just a specific one, given that I know its Id.

Is there any way to get the Id of all the existing ones?

1 Answer 1

3

You need to perform a Tooling API Query. The endpoint for a query is at /services/data/vXX.X/tooling/query, which takes a parameter, q, that represents the query. The query itself must be URL escaped as normal:

/services/data/v42.0/tooling/query?q=SELECT+id,name,sourceid+from+sandboxinfo

Note that you can only query this in production, and only if you have sufficient access to use the Tooling API.

3
  • Great, as always! :-) Apr 13, 2018 at 13:46
  • I know it's out of the scope of the question, but by any chance do you know why the SourceId would be null? Apr 13, 2018 at 13:59
  • 1
    @JavierGarcíaManzano The sandbox was cloned from production. I'm not sure if sandboxes from Spring '18 release onwards will have the SourceId of production or not, but any sandboxes last refreshed before Spring '18 would have a null value for sure. (edit) Also, thinking about it, if the source sandbox were subsequently deleted, that should also null out the SourceId field as well.
    – sfdcfox
    Apr 13, 2018 at 14:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .