Question

Different results when asking image list to API v1 versus API v2 ?

  • Posted October 14, 2014

Hello there,

Any clue about why API v1 is returning 105 results when asking all images against 36 results (including all pages) when asking to API v2 ?

#API v1:

curl -s -X GET 'https://api.digitalocean.com/v1/images/?client_id=$CLIENT_ID&api_key=$API_KEYc&filter=ams2' | python -mjson.tool | grep name | wc -l

105 <---- TOTAL

#API v2:

curl -s -X GET "https://api.digitalocean.com/v2/images/?page=3" -H "Authorization: Bearer $DO_TOKEN" | python -mjson.tool
{
    "images": [],
    "links": {
        "pages": {
            "first": "https://api.digitalocean.com/v2/images/?page=1",
            "prev": "https://api.digitalocean.com/v2/images/?page=2"
        }
    },
    "meta": {
        "total": 36 <---- TOTAL
    }
}

To add some more info, if I try to find a concrete image by slug/id, some of them are returned in API v1 but not in API v2:

#API v1

curl -s -X GET 'https://api.digitalocean.com/v1/images/1556606?client_id=$CLIENT_ID&api_key=$API_KEY' | python -mjson.tool
{
    "image": {
        "distribution": "Arch Linux",
        "id": 1556606,
        "name": "Arch Linux 2013.12.01 Dual ISO",
        "public": true,
        "region_slugs": [
            "nyc1",
            "ams1",
            "sfo1",
            "nyc2",
            "ams2",
            "lon1",
            "nyc3",
            "ams3"
        ],
        "regions": [
            1,
            2,
            3,
            4,
            5,
            7,
            8,
            9
        ],
        "slug": null
    },
    "status": "OK"
}

#API v2

curl -s -X GET "https://api.digitalocean.com/v2/images/1556606" -H "Authorization: Bearer $DO_TOKEN" | python -mjson.tool
{
    "id": "not_found",
    "message": "The resource you were accessing could not be found."
}

Thanks!

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi!

This was actually a bug in APIv1 due to an underlying component being upgraded. The extra images that were being exposed were deprecated releases. This should now be resolved. Thank you for catching this and bringing it up!