title: WooCommerce REST API Setting Product Image - WooCommerce.Net
body: <p>I'm trying to add products using the WooCommerce .Net Rest API. I have managed to add a product in using this. However, I can't get it to add the product image.</p>
  
  <p>I have the following code for adding a product:</p>
  
  <pre><code>        Product p = new Product();
  
          p.name = "Ben";
          p.description = "Testing Dan's Example Code.";
          p.short_description = "I hope it works.";
          p.price = 3;
  
          await wc.Product.Add(p);
  </code></pre>
  
  <p>I can't find anything on how to add an image to this product though. </p>
  
  <pre><code>p.images = ??;
  </code></pre>
  
  <p>I have found the following JSON which is used to add images but I can't work out the c# equivalent.</p>
  
  <pre><code>     "images":[
       {
          "src":"https://www.example.com/image.jpg",
          "position":0
       }
       ],
  </code></pre>
  
  <p>Does anyone have any ideas regarding this?</p>
  
  <p>EDIT: I have attempted to write my own way of uploading the image and have got the following:</p>
  
  <pre><code>        List&lt;Image&gt; productImageList = new List&lt;Image&gt;();
  
          productImageList.Add(new Image()
          {
              name = "TEST",
              src = "www.test.com",
              position = 0
          });
  </code></pre>
  
  <p>However, image does not contain a definition for these names. Is there a WooCommerce Rest version of Image that would work?</p>
  
  <p>EDIT2: To answer my own question above - Yes there is.</p>
  
  <pre><code>       productImageList.Add(new ProductImage()
          {
              name = "TEST",
              src = "https://res.cloudinary.com/pricecheck/image/upload/c_pad,h_800,w_800,d_noimg.jpg/TOAQU093-1.jpg",
              position = 0
          });
  </code></pre>
  
  <p>The above code will allow me to add a product to an image. However, the image doesn't retain its Cloudinary source once it has been uploaded. The image is added to the wordpress library and the source becomes this.</p>