1

Our architecture uses Salesforce to send some emails to clients automatically, so to reproduce the full architecture in a demo environment we need to have an identical instance of Salesforce.

We can use a Sandbox, we have found the SandboxProcess and Sandbox. How do we query all the instances via rest api?

2

2 Answers 2

3

The trick we had to understand is that sObjects are not implementing REST resource "collection" default behaviour, i.e.

GET /services/data/v40.0/tooling/sobjects/SandboxInfo/

will non return all the Sandbox Info. Therefore one has to use the QUERY endpoint:

GET /services/data/v40.0/tooling/query/?q=
Select+id,SandboxName+from+SandboxInfo

We now have the Name and Id (they are stable, so one could check them the UI) and we can issue a

PATCH /services/data/v40.0/tooling/sobjects/SandboxInfo/ID

with body

{ “licenseType”: “DEVELOPER” }
2
  • 1
    Small bug in the above query @Emondo1984 name isn't a valid field, its "SandboxName" instead -- but this was a big help! Oct 27, 2017 at 20:09
  • @Edmondo1984 do you want to mark your answer as accepted to get this out of the unanswered questions queue.
    – Dave Humm
    Oct 29, 2017 at 21:25
0

With an accesstoken/session id to the corresponding production org you can use the tooling api via REST to query the SandboxInfo.

1
  • 2
    I tried to query from the workbench but was unable to query the records ( I was only able to query the sObject definition of SandboxInfo)
    – Edmondo
    Sep 25, 2017 at 5:35

You must log in to answer this question.

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