cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot update Image using PUT through API

Cannot update Image using PUT through API

Hi,

 

When I attempt to use a PUT to update an image I get various different errors and seem to be unable to identify when they trigger. The first error I get is EntryID has no corresponding setter, and the second is no entry with that ID, which seems wrong because doing a GET will highlight the IDs that I want to use.

 

Here is my code: 

var client = new RestClient("http://www.mystore.com/rest/V1/products/351740040/media/457");
var request = new RestRequest(Method.PUT);
request.AddHeader("postman-token", "2aacaa29-fcab-59af-1f08-c83894036d89");
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer gsgl5ol3tm08n5wmrwq672616hvi7dgj");
request.AddParameter("application/json", "{\n \"entry\":{\n \"types\":[\n \"image\",\n \"thumbnail\",\n \"small_image\"\n ],\n \"label\":\"Image\",\n \"media_type\":\"image\",\n \"disabled\":false,\n \"content\":\n {\n \"type\":\"image\\/jpeg\",\n \"name\":\"maxresdefault.jpg\",\n \"base64_encoded_data\":\"Encoded Image"\n },\n \"position\":1,\n\t \"file\":\"\\/t\\/e\\/maxresdefault.jpg\"\n }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

 

Any help would be appreciated.