Ask Your Question
1

how to extract the image details from glance api

asked 2014-12-22 12:48:02 -0600

eugene.goldberg gravatar image

Greetings! I need to query image details from glance api. I am using the following approach in my .NET client:

var client = new HttpClient();

        client.DefaultRequestHeaders.Add("User-Agent", "python-keystoneclient");
        client.DefaultRequestHeaders.Add("X-Auth-Token", authToken);
        HttpResponseMessage response = await client.GetAsync("http://10.0.0.32:9292/images/");
        var responseBody = await response.Content.ReadAsStringAsync();
        var json = responseBody;

        JObject allImages = JObject.Parse(json);
        var imageList = allImages["versions"];

        foreach (var item in imageList)
        {
            Console.WriteLine(item);
        }

However, the response I get looks like this:

"{\"versions\": [{\"status\": \"CURRENT\", \"id\": \"v2.2\", \"links\": [{\"href\": \"http://10.0.0.32:9292/v2/\", \"rel\": \"self\"}]}, {\"status\": \"SUPPORTED\", \"id\": \"v2.1\", \"links\": [{\"href\": \"http://10.0.0.32:9292/v2/\", \"rel\": \"self\"}]}, {\"status\": \"SUPPORTED\", \"id\": \"v2.0\", \"links\": [{\"href\": \"http://10.0.0.32:9292/v2/\", \"rel\": \"self\"}]}, {\"status\": \"CURRENT\", \"id\": \"v1.1\", \"links\": [{\"href\": \"http://10.0.0.32:9292/v1/\", \"rel\": \"self\"}]}, {\"status\": \"SUPPORTED\", \"id\": \"v1.0\", \"links\": [{\"href\": \"http://10.0.0.32:9292/v1/\", \"rel\": \"self\"}]}]}"

As you can see, the response contains links, but not the image details.

What is the proper syntax for the follow-up query, to bring the details of each image?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-12-28 03:38:02 -0600

Glance image-show image_uuid.

Look at the python-glanceclient code to see how it done if you dont want use the cli.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-12-22 12:48:02 -0600

Seen: 306 times

Last updated: Dec 28 '14