indieweb / micropub-extensions

Issue tracking for Micropub extensions
https://indieweb.org/Micropub-extensions
10 stars 0 forks source link

Response from Media Endpoint #13

Open dshanske opened 5 years ago

dshanske commented 5 years ago

The Micropub spec doesn't define a particular response body when uploading to the media endpoint. It only defines that the response include the created URL in the Location header. However, some tools are easier to work with if they can use the response body instead of having to parse the HTTP headers.

This should also be the same response format used when querying the endpoint to find the last thing uploaded or other proposed queries

The minimum response body is a url property. There are suggestions of other properties it might return, including parsed metadata, alternative file version, etc.

Etc.

j4y-funabashi commented 5 years ago

Currently my media endpoint returns the following when I call it with q=source

{
    "items": [
        {
            "url": "https://media.funabashi.co.uk/2019/vid.mp4",
            "mime_type": "video/mp4",
            "date_time": "2019-03-20T16:53:29.762421201Z",
            "lat": 53.800968166666664,
            "lng": -1.5413559444444442
        }
    ]
}
manton commented 4 years ago

I don't currently support this, but I just want to point to #14 here since the response should be the same for both. There was a discussion there about using published for the date so that it's consistent with other parts of Micropub. Here's what my response from the media endpoint with q=source looks like:

{
  "items": [
    {
      "url": "https://www.manton.org/uploads/2020/058fa92305.png", 
      "width": 1200, 
      "height": 816,
      "published": "2020-05-27T14:14:09+00:00"
    }, 
    {
      "url": "https://www.manton.org/uploads/2020/7a57980ca2.jpg", 
      "width": 1800, 
      "height": 1800,
      "published": "2020-05-20T02:22:09+00:00"
    }
  ]
}
dshanske commented 4 years ago

In order to address this, the initial agreement at the Micropub Popup 2020 was to require on upload a response that included a url property only. Any other properties are still pending for discussion, but suggested that it be considered based on prior art of EXIF properties.

aaronpk commented 4 years ago

Copying notes from the wiki:


Content-Type: application/json

{
  "url": "https://media.aaronpk.com/filename.jpg"
}

This response currently produced by:

And consumed by:

dshanske commented 4 years ago

Looking at Exif 2.32 http://www.cipa.jp/std/documents/download_e.html?DC-X010-2020, which is the latest version and makes some changes.

EXIF has 3 time properties

Suggesting that updated might take the place of datetime.

Other potentially useful properties to start

There are other properties, such as lens, camera make/model, ISO, aperture...

And this only covers photos...

manton commented 4 years ago

Micro.blog now returns url in JSON from the media endpoint when uploading. The url matches the value in the Location header. If you're uploading video, Micro.blog also generates a poster frame and returns that too:

{
  "url": "https://manton.org/uploads/2020/example.mov",
  "poster": "https://manton.org/uploads/2020/example.png"
}
manton commented 2 years ago

Bumping this since @dshanske mentioned it in chat… I'd be in favor of adding image width and height as simple fields in the JSON response, but I don't think we need to include every possible bit of metadata there.

dshanske commented 2 years ago

Agree about every piece of metadata. I'd like width, height, and dates...and to address the question of multiple sizes the server might generate. Many services have the concept of a thumbnail version in their returns, but it isn't consistent. @manton commented in chat that Micro.blog returns a 400w thumbnail for images. Because of different sizes/shapes of images, there is no good answer.