3

We built and are enhancing a "Salesforce Sandbox Manager" to allocate Salesforce sandboxes to our Jenkins CI/CD and occasionally facilitate other sandbox management tasks.

We'd like our manager to monitor which version each sandbox is on, so it can alert us when it gets old or falls out of sync with either production or other selected sandboxes.

Is there any API (preferably REST) whcih we can use to request the information, either by making a call to production or by making a call to the sandbox itself?

6

Making a call to the {your sandbox domain}/services/data REST API will return a JSON response with all the available API versions. Here is the JSON response:

[...,
{
  "label" : "Winter '19",
  "url" : "/services/data/v44.0",
  "version" : "44.0"
}, {
  "label" : "Spring '19",
  "url" : "/services/data/v45.0",
  "version" : "45.0"
}, {
  "label" : "Summer '19",
  "url" : "/services/data/v46.0",
  "version" : "46.0"
}, {
  "label" : "Winter '20",
  "url" : "/services/data/v47.0",
  "version" : "47.0"
} ]

@BrianKessler here is an image from workbench:

enter image description here

  • Almost exactly what I was looking for but this seems to be missing the query which should be snet to the endpoint. It would be great if you could include it. Thanks in advance. :-) – Brian Kessler Nov 21 at 10:51
  • 1
    What url query parameter are you referring to? That is just a GET request with no parameters. – Bryan Anderson Nov 21 at 13:06
  • Honestly, I'm not sure. I didn't look closely enough at the answer. I just saw the versions and thought I would be "good to go". But now I realize, it looks like every sandbox will have an embedded object for each season/version? So I can't simply query to find the latest, but rather will also need to dig down into the result to find the most recent (largest version number) mentioned? – Brian Kessler Nov 22 at 16:28
  • 1
    I think you should be able to look at the last element in the array sent back and say confidently that is the "latest" version for that particular instance – Bryan Anderson Nov 22 at 16:29
  • For lack of other proposed answers, I guess I'm going to go with this, though I might create an method to parse and compare the values instead of relying on the implementaton detail that they will be in order. unless that is published somewhere. Cheers! :-) – Brian Kessler Nov 23 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.