indieweb / micropub-extensions

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

Query for contacts #39

Open manton opened 4 years ago

manton commented 4 years ago

Copying this here from the wiki.

For apps to be able to autocomplete by known contacts we need some way to query these values. This would be very useful for person-tag

This is supported by the Drupal IndieWeb module and Indigenous for Android.

Example response

q=contact

Note: the _internal_url can be used for updating the contacts via micropub

 "contacts": [
    {
      "name": "Kevin Marks",
      "photo": "http://known.kevinmarks.com/file/9255656669173b7867ab839ee6556f9e",
      "url": "http://known.kevinmarks.com/profile/kevinmarks",
      "nickname": "kevinmarks",
      "_internal_url": "https://example.com/contact/1",
    },
    {
      "name": "Kristof De Jaeger",
      "photo": "https://realize.be/vue/images/swentel-200.png",
      "url": "https://realize.be",
      "nickname": "swentel",
      "_internal_url": "https://example.com/contact/2",
    },
  ]

Implementations

Clients:

Servers:

manton commented 4 years ago

Based on the discussion from the Micropub popup session, this should be updated to use a filter parameter. Also, if no filter is specified, a server may return all contacts, but multi-user platforms could return an empty list (or some other partial list of users).

aaronpk commented 4 years ago

My Micropub endpoint now supports this!

?q=contact&filter=manton

{
  "contacts": [
    {
      "name": "Manton Reece",
      "nickname": "manton",
      "photo": "https://aaronparecki.com/2018/09/03/14/photo.jpg",
      "url": "https://manton.org"
    }
  ]
}

Internally, it's actually sorting the list based on the frequency that I've interacted with the person. So typing just "m" turns up a list of a bunch of people with @manton at the top.

I'm not sold on the name _internal_url, and I'm also not expecting to edit my contacts from an app just yet, so I'm holding off on including that URL for now.

manton commented 4 years ago

Micro.blog now supports this. Identical response as what @aaronpk posted: name, nickname, photo, and url. Because Micro.blog currently searches all users, it requires filter to be present and have at least 3 characters. I may tweak this to only search users you're following for shorter length filters.

grantcodes commented 4 years ago

What's the reasoning behind this not using proper h-card json?

Seems a bit strange to have posts return full mf2 json but not contacts.

But on the other hand the simpler format is definitely much easier to use.

vikanezrimaya commented 4 years ago

Probably omitted for simplicity. I'd rather have contacts return MF2, but, alas, major implementations already expect something else. One could add MF2 type and properties though, and leave other stuff there for backwards compatibility.

jamietanna commented 3 years ago

I've had support for this since 2020-05-10, with the ability to store silo usernames to support @-mentioning on silos:

GET https://www-api.jvt.me/micropub?q=contact
{"contacts":[...,{"name":"Aaron Parecki","nickname":"aaronparecki.com","url":"https://aaronparecki.com/","silos":{"twitter":"aaronpk"},"_internal_url":"https://www.jvt.me/contacts/aaronparecki.com/"}]

(Originally published at: https://www.jvt.me/mf2/2021/02/n0lhc/)

jalcine commented 2 years ago

I'm open to both allowing MF2+JSON and JF2-esque formatting here (mainly, so I can return all the fields for my contacts). Is there any issue with people considering something like https://github.com/indieweb/webmention-ecosystem/issues/1 with it defaulting to jf2 to keep backward compatibility? Koype will be implementing it such that it returns MF2+JSON by default (that's how information is stored) but will default to this JF2 payload.

(Originally published at: https://jacky.wtf/2022/6/i0VR)