1

I want to query information about the logged-in user using me, and this site parameter is creating some small problems.
I am developing a visual studio extension where upon logging in a user will get all his network accounts using /me/associated. After that, on clicking on any of the associated account, he will get more information about the user in that site, eg, stackoverflow, using /me. In this step, there is a parameter site. So how to have the parameter site where the user have accounts, so that I will pass it to /me?

  1. On what basis is the site parameter present? Is it the api_site_parameter of site?

  2. It would be better if this parameter wasn't present. Then, it would return a list of user in every site. This would make me independent of site.

1
  • The question is a bit unclear. State your ultimate purpose. Commented Feb 17, 2016 at 21:19

1 Answer 1

2

RE:

  1. Is site the api_site_parameter of the site object?
    Yes.   Although as stated in the "Per-Site Methods" section of the main doc page, you can also use the full domain name, EG cooking.stackexchange.com.

  2. No, user and shallow_user are site specific objects. You absolutely need to specify site to get these.


Supposedly, the assumption is that all /me routes are site specific -- used by apps that only focus on one domain.

As stated in the "Users" section of the main doc page:

All user methods that take an {ids} parameter have a /me equivalent method that takes an access_token instead.
These methods are provided for developer convenience, with the exception of plain /me, which is actually necessary for discovering which user authenticated to an application.

Buried in 2 or 3 particular doc pages it states:

{These methods are} provided for consumers who make strong assumptions about operating within the context of a single site rather than the Stack Exchange network as a whole.

Where the applicable routes are of the form /users/{id}/{Some SE-wide object} and by implication this would include the /me/{Some SE-wide object} routes.

This certainly should be better documented in the pages where this doesn't make sense (EG: /me, /me/notifications, /me/inbox, and /me/inbox/unread).

And note that other /me/ routes, like /me/associated and /me/merges, do not require a site parameter.


What is your true purpose?

The question is unclear.

  • To get the user's Stack Exchange-wide id, use the /access-tokens/{accessTokens} route:

    "account_id": 131474,
    "expires_on_date": 1455815636,
    "access_token": "3OT6bxxxxxxxxxxqPMZK9Q))"
    
  • To get all of the user's associated accounts, use the /me/associated route:

    {
        "user_id": 331508,
        "site_name": "Stack Overflow"
    }, {
        "user_id": 55814,
        "site_name": "Server Fault"
    }, {
        "user_id": 41023,
        "site_name": "Super User"
    },
    etc.
    
1
  • Your 2 points answered my question. Sending full domain name like "stackoverflow.com" which is returned as site_url from /me/associated solved my problem. Thanks. Commented Feb 18, 2016 at 6:54

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.