使用meteor从stackoverflow获取用户数据

Get user data from stackoverflow using meteor

本文关键字:用户 用户数 数据 获取 stackoverflow meteor 使用      更新时间:2023-09-26

我正在尝试开发一个流星应用程序,在此我想从stackoverlow获得用户的数据。

假设,我的用户名是 https://stackoverflow.com/users/1934044/user1934044

当用户在我的文本框中输入这个链接时,我想获得关于这个用户的信息

我们是否需要在stack apps中注册一个应用程序,或者我们可以直接从stackexchange api中获取数据。

我没有在我的应用程序中使用stackexchange登录系统(OAUTH)。

如果我们能直接得到数据,该怎么做呢

谁能告诉我教程在哪里

您可以使用以下方法通过用户ID获取用户详细信息端点:

  • /用户/{id}

有关详细信息,请参阅下面的堆栈交换文档

https://api.stackexchange.com/docs/users-by-ids

我已经写了Java Wrapper over Stack Exchange API。

你可以试试。https://github.com/sanjivsingh/stackoverflow-java-sdk

示例代码:
StackExchangeApiQueryFactory queryFactory  = StackExchangeApiQueryFactory.newInstance();
System.out.println("get user by Id");
PagedList<User> users = queryFactory.newUserApiQuery()
        .withUserIds(1934044).listUserByIds();

回到你的问题:

  • 这个方法不需要任何applicationKey和accessToken

您可以使用Meteor Http包来调用api并以json对象的形式获取数据。

,

服务器

,

return Meteor.methods({
    getUserData: function (user_id) {
        var url =   "give the api url"+user_id;
        this.unblock();
        return Meteor.http.get(url);
    }
});