title: WP Rest API upload image
body: <p>I'm trying to upload image via Wordpress REST api v2. So far all I managed was to create empty entries in wordpress media library. Meaning they have image names, but no actual image.</p>
  
  <p>POST Request:</p>
  
  <pre><code>http://localhost/wordpress/wp-json/wp/v2/media
  
  Authorization: Basic d29yZHByZXNzOndvcmRwcmVzcw==
  Content-Type: application/json
  Content-Disposition: attachment;filename=map2.jpg
  
  {
    "source_url" : "file:///C:/Users/x/Desktop/map2.jpg"
  }
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>{
    "id": 127,
    "date": "2016-05-25T08:43:30",
    "date_gmt": "2016-05-25T08:43:30",
    "guid": {
      "rendered": "http://localhost/wordpress/wp-content/uploads/2016/05/map2-3.jpg",
      "raw": "http://localhost/wordpress/wp-content/uploads/2016/05/map2-3.jpg"
    },
    "modified": "2016-05-25T08:43:30",
    "modified_gmt": "2016-05-25T08:43:30",
    "password": "",
    "slug": "map2-3",
    "status": "inherit",
    "type": "attachment",
    "link": "http://localhost/wordpress/map2-3/",
    "title": {
      "raw": "map2-3",
      "rendered": "map2-3"
    },
    "author": 1,
    "comment_status": "open",
    "ping_status": "closed",
    "alt_text": "",
    "caption": "",
    "description": "",
    "media_type": "image",
    "mime_type": "image/jpeg",
    "media_details": {},
    "post": null,
    "source_url": "http://localhost/wordpress/wp-content/uploads/2016/05/map2-3.jpg",
    "_links": {
      "self": [
        {
          "href": "http://localhost/wordpress/wp-json/wp/v2/media/127"
        }
      ],
      "collection": [
        {
          "href": "http://localhost/wordpress/wp-json/wp/v2/media"
        }
      ],
      "about": [
        {
          "href": "http://localhost/wordpress/wp-json/wp/v2/types/attachment"
        }
      ],
      "author": [
        {
          "embeddable": true,
          "href": "http://localhost/wordpress/wp-json/wp/v2/users/1"
        }
      ],
      "replies": [
        {
          "embeddable": true,
          "href": "http://localhost/wordpress/wp-json/wp/v2/comments?post=127"
        }
      ]
    }
  }
  </code></pre>
  
  <p>I get no errors, everything's seem to be working, except response-><strong>post</strong> and response-><strong>media_details</strong> is either null or empty. Ofcourse image itself is not uploaded.</p>
  
  <p>Based on this <a href="https://github.com/WP-API/WP-API/issues/1768" rel="noreferrer">GitHub WP-API Adding Media</a> ticket, I should send 2 requests. First <code>POST</code> request should return data with post object. I would send this post object via <code>PUT</code> method, and image should be uploaded...since I have no post object, this is not possible.</p>
  
  <p>Any ideas what am I doing wrong?</p>