NS0-402 practice question 12 of 15

An IT administrator needs to query image metadata of an OpenStack server using the REST API. Which REST API method would accomplish this task?

Full set: 58 questions
Answer options
A: DELETE
B: POST
C: GET Correct answer
D: PUT
Correct Answer:
C. GET
Explanation

The GET method is the standard HTTP verb used in RESTful APIs to retrieve or query a representation of a specified resource. To query the metadata of an OpenStack image, an administrator would send a GET request to the appropriate API endpoint for the Image service (Glance). This action is read-only and does not alter the state of the resource, which is the intended purpose of a query operation.

Why Incorrect

A. DELETE: This method is used to remove a specified resource, such as deleting an image, not for querying its metadata.
B. POST: This method is used to submit an entity to the specified resource, often causing a change in state or creation of a new resource.
D. PUT: This method replaces all current representations of the target resource with the request payload, effectively updating the resource.

References

1. OpenStack API Reference - Image Service (Glance) API v2: The official documentation for the OpenStack Image service explicitly lists the GET method for retrieving information.

Operation: Show image details

Method and URI: GET /v2/images/{imageid}

Reference: OpenStack Foundation. (2023). Image Service API v2 Reference. OpenStack Documentation. Retrieved from https://docs.openstack.org/api-ref/image/v2/index.html#show-image-details. This section details how to retrieve the core properties of a specific image.

2. OpenStack API Reference - Image Service (Glance) API v2: For listing multiple images, which is also a query operation.

Operation: List images

Method and URI: GET /v2/images

Reference: OpenStack Foundation. (2023). Image Service API v2 Reference. OpenStack Documentation. Retrieved from https://docs.openstack.org/api-ref/image/v2/index.html#list-images. This section describes how to retrieve a list of available images.

3. Fielding, R. T. (2000). Architectural Styles and the Design of Network-based Software Architectures. University of California, Irvine. (Doctoral dissertation).

Reference: Chapter 5, Section 5.1.1 "Method Information". This foundational text on REST architecture defines the semantics of HTTP methods. It states, "The GET method means retrieve whatever information... is identified by the Request-URI." This academic source establishes the fundamental principle behind the correct answer.

Scroll to Top