curl -X GET "https://api.example.com/api/v1/product-images/1"
Retrieves detailed information about a specific product image.
Method and Path
GET /api/v1/product-images/{id}
Path Parameters
The unique identifier of the product image to retrieve
Response
The product image object
Unique identifier for the product image
ID of the product this image belongs to
Alternative text description for accessibility
Order in which the image should be displayed (lower numbers appear first)
Response Codes
Product image successfully retrieved
Product image with the specified ID was not found
Response Example
{
"id": 1,
"productId": 101,
"imageUrl": "https://example.com/images/sofa-front.jpg",
"altText": "Modern grey sofa - front view",
"displayOrder": 1
}
Error Response Example
{
"status": 404,
"error": "Not Found",
"message": "Product image not found with id: 999"
}
Usage Examples
Get Product Image Details
curl -X GET "https://api.example.com/api/v1/product-images/1" \
-H "Content-Type: application/json"
Get Product Image with JavaScript
fetch('https://api.example.com/api/v1/product-images/1', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Get Product Image with Python
import requests
response = requests.get('https://api.example.com/api/v1/product-images/1')
if response.status_code == 200:
image = response.json()
print(f"Image URL: {image['imageUrl']}")
print(f"Alt Text: {image['altText']}")
else:
print(f"Error: {response.status_code}")