Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query for contacts #39

Open
manton opened this issue Jul 26, 2020 · 7 comments
Open

Query for contacts #39

manton opened this issue Jul 26, 2020 · 7 comments

Comments

@manton
Copy link

manton commented Jul 26, 2020

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.

  • Discovery of the endpoint (as in, it exists), happens through the query for supported queries, see Query for Supported Queries #7
  • q=contact&search=aaron would do a search for any field which matches .aaron. thereby allowing the client application to autosuggest and insert links.
  • q=contact would return the complete list, which should only be so that clients (e.g. Indigenous) can cache all contacts locally.
  • The response in JSON is a list of h-cards

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:

  • IndieWeb for Drupal
@manton
Copy link
Author

manton commented Jul 26, 2020

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
Copy link
Member

aaronpk commented Jul 27, 2020

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
Copy link
Author

manton commented Jul 27, 2020

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
Copy link

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
Copy link

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
Copy link

jamietanna commented Feb 19, 2021

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
Copy link

jalcine commented Jun 29, 2022

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 indieweb/webmention-ecosystem#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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants