title: upload image with wordpress rest api
body: <p>I am having trouble uploading an image with the WordPress REST API (WP-API). Can someone provide some sample code. Basically I have an image that I got from a service and I'm showing in an <code>&lt;img&gt;</code> tag. Now I need to take that image and save it in the media library using javascript. </p>
  
  <p>Alternatively (not using WP-API) if there is a plugin that would do that, I can pass the url for the image to get is saved in the media library.</p>
  
  <p>Thanks</p>