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

October 14, 2014 721 views

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!

1 Answer

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!

Have another answer? Share your knowledge.