Skip to main content

Create main image relationships

POST 

https://euwest.api.elasticpath.com/pcm/products/:productID/relationships/main_image

Associates a main image with the specified product.

Request

Path Parameters

    productID stringrequired

    A unique identifier for the product.

Body

    data object
    idstring

    The ID of the image file.

    Example: 00000000-0000-0000-0000-000000000000
    typestring

    This represents the type of resource being returned. Always file.

    Possible values: [file]

Responses

No Content

Authorization: http

name: bearerAuthtype: httpscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://euwest.api.elasticpath.com/pcm/products/:productID/relationships/main_image");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"id\": \"00000000-0000-0000-0000-000000000000\",\n \"type\": \"file\"\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://euwest.api.elasticpath.com
Auth
Parameters
— pathrequired
Body
{
  "data": {
    "id": "00000000-0000-0000-0000-000000000000",
    "type": "file"
  }
}
ResponseClear

Click the Send API Request button above and see the response here!

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.