Feature Request: "latest" as a special key for version number in API calls


#1

If I want to list domains on my Fastly service, as far as I’m aware, I have to first lookup the current version number for a service before I can query GET /service/X/version/Y/domain. It would be much easier just to hit GET /service/X/version/latest/domain to get whatever the domains are on the latest version.


#2

I agree that would be awesome. While you’re waiting for that you can utilize this that I put together for this exact reason in our CI/CD projects:
curl -X GET -H "Fastly-Key: ${fastlyStageKey}" "https://api.fastly.com/service/${fastlyServiceId}/version" >> versions.txt

And then get active version from this python script:

`## Find the current active Fastly version

import json
import sys
objs=json.load(sys.stdin)
x=[int(o["number"]) for o in objs if o["active"]]
print x[0]`

#3

It’s on our ToDo list!