跳到主要内容

mobage.api

概要​

此模块中的功能,包括从JavaScript调用Mobage Open Platform提供的Social API所需的功能。

功能列表​

在mobage.api 模块中,有以下子模块和方法。原则上此模块的各方法中可使用的参数等依据后端的RESTful API。

通用事项​

Common Query Parameters​

mobage.api 模块中的API与RESTful API同样,可使用GET类的方法和部分PUT方法,对筛选和排序所需的查询参数进行指定。
以下面指定查询参数。关于它们的使用,请参见前项所述对应RESTful API的。

propertytitletyperequireddescription
fields想要获取的字段列表arrayfalse使用逗号分隔列表,指定想要获取的字段。
count想要获取的条数integerfalse指定想要获取的条数。如果省略,通常视为指定 50。
startIndex开始位置integerfalse指定开始位置。默认值和最小值为 1。
filterBy过滤条件字段integerfalse指定想要指定条件的字段名。
filterOp过滤条件式stringfalse指定equals 等条件式。
filterValue过滤值stringfalse指定过滤条件值。
sortBy排序字段stringfalse指定排序条件的字段名。
sortOrder排序顺序stringfalse指定排序的顺序 (ascending, descending)。

Error Response​

Social API执行错误时,向前项所述Callback函数的error参数传递mobage.error.APIError对象。此 mobage.error.APIError对象带有的属性如下所示。

propertytitletypedescription
httpStatusHTTP 响应状态代码integer实际反馈的 HTTP 状态代码值。
title错误标题stringHuman Readable 错误的标题。
detail错误详细string(Optional) 错误的补充信息。

方法​

mobage.api.people.get​

获取People 所需的 API 。是People API - RESTful API的JavaScript接口。

语法​

mobage.api.people.get(params , cb);

参数​

params​

Object 型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
userId用户 IDstringtrue指定核心用户的ID。如果指定 @me,则视为指定access token的Re-sourceOwner的用户ID。
groupId群组 IDstringtrue指定 @self 时,参照自身的资源。指定 @friends, @all时,参照{userId}中指定的用户好友列表的资源。
personId对方的用户IDstringfalse当{groupId}被指定为@friends, @all 时,如果指定的{personId}非好友,会反馈404 Not Found。

cb​

function型的参数。

说明​

详情请见People API - RESTful API。

mobage.api.appdata.get​

设置、获取Appdata所需的API 。是AppData API - RESTful API的JavaScript接口。

语法​

mobage.api.appdata.get(params , cb);

参数​

params​

Object 型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
userId用户 IDstringtrue指定核心用户的ID。如果指定 @me,则视为指定access token的Re-sourceOwner的用户ID。
groupId群组 IDarraytrue指定 @self 时,参照自身的资源。指定 @friends, @all时,参照userId中指定的用户好友列表的资源。
appId应用软件 IDarraytrue请指定@app或当前执行的应用软件的 ID。

cb​

function型的参数。

mobage.api.appdata.update​

备注

创建和更新Appdata时,请使用此处的方法。

语法​

mobage.api.appdata.update(params , cb);

参数​

params​

Object型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
userId用户 IDstringtrue指定核心用户的ID。如果指定 @me,则视为指定access token的Re-sourceOwner的用户ID。
groupId群组 IDarraytrue指定 @self 时,参照自身的资源。指定 @friends, @all时,参照userId中指定的用户好友列表的资源。
appId应用软件 IDarraytrue请指定@app或当前执行的应用软件的 ID。

cb​

function 型的参数。

mobage.api.appdata.delete​

语法​

mobage.api.appdata.delete(params , cb);

参数​

params​

Object型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
userId用户 IDstringtrue指定核心用户的ID。如果指定 @me,则视为指定access token的Re-sourceOwner的用户ID。
groupId群组 IDarraytrue指定 @self 时,参照自身的资源。指定 @friends, @all时,参照userId中指定的用户好友列表的资源。
appId应用软件 IDarraytrue请指定@app或当前执行的应用软件的 ID。

cb​

function型的参数。

mobage.api.avatar.get​

获取Avatar所需的 API 。是Avatar API - RESTful API的JavaScript接口。

语法​

mobage.api.avatar.get(params , cb);

参数​

params​

Object 型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
userId用户 IDstring or arraytrue指定核心用户的ID。如果指定 @me,则视为指定access token的Re-sourceOwner的用户ID。
groupId群组 IDstringtrue指定 @self 时,参照自身的资源。指定 @friends, @all时,参照userId中指定的用户好友列表的资源。
size大小stringfalse指定large/medium/small 中的任意一项。
view显示stringfalse指定entire/upper 中的任意一项。
emotion表情stringfalse指定defined/normal/smile/cry/angry/shy中的任意一项。
dimension选择2D/3Dstringfalse指定defined/2D/3D 中的任意一项。
transaparent透明stringfalse指定true/false 中的任意一项。
type格式类型stringfalse指定image 中的任意一项
extension格式扩展名stringfalse指定gif/png 中的任意一项

cb​

function型的参数。

说明​

详情请参见 Avatar API - RESTful API。

mobage.api.textdata.get​

获取TextData所需的API 。是TextData API - RESTful API的JavaScript接口。

语法​

mobage.api.textdata.get(params , cb);

参数​

params​

Object 型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
appId应用软件 IDstringtrue请指定@app或当前执行的应用软件的 ID。
textdataGroupNameTextDataGroup 的 namestringtrue指定TextDataGroup 的 name 字段值。
groupId群组 IDstringtrue指定@all。
textdataIdTextData 的 idstring or arrayfalse指定TextData 的 id。

cb​

function型的参数。

说明​

详情请参见Textdata API - RESTful API。

mobage.api.textdataGroup.get​

获取TextDataGroup所需的 API。是TextData API - RESTful API的JavaScript接口。

语法​

mobage.api. textdataGroup .get(params , cb);

参数​

params​

Object 型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
appId应用软件 IDstringtrue请指定@app或当前执行的应用软件的 ID。
groupId群组 IDstringtrue指定 @all。

cb​

function 型的参数。

说明​

详情请参见Textdata API - RESTful API。

mobage.api.profanity.check​

检查用户输入字符串中有无不当语句所需的 API。是Profanity API - RESTful API的JavaScript接口。

语法​

mobage.api. profanity .check(params , cb);

参数​

params​

Object 型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
text自由文本stringtrue请指定用户发帖的自由文本。

cb​

function 型的参数。

说明​

详情请参见 profanity API - RESTful API。

mobage.api.blacklist.get​

获取BlackList所需的 API 。是BlackList API - RESTful API的JavaScript接口。

语法​

mobage.api. blacklist .get(params , cb);

参数​

params​

Object 型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
userId用户 IDstringtrue表示当前登录用户的 @me或用户ID。
groupId群组 IDstringtrue指定 @all。
personId用户 IDstringtrue想要确认是否已被拉黑的用户 ID。

cb​

function型的参数。

说明​

详情请参见Blacklist API - RESTful API。

mobage.api.bankInventory.get​

获取Bank Inventory所需的API 。是处理Bank API - RESTful API 中的 Inventory 的JavaScript接口。

语法​

mobage.api. bankInventory .get(params , cb);

参数​

params​

Object 型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
appId应用软件 IDstringtrue指定 @app 或应用软件ID。
itemId物品 IDstringfalse指定在Mobage Developers Japan(开发者网站)中注册的特定物品ID。

cb​

function 型的参数。

说明​

详情请参见Blacklist API - RESTful API。

mobage.api.chatChannel.get​

获取Chat Channel所需的API 。是Chat Channel API - RESTful API的JavaScript接口。

语法​

mobage.api. chatChannel .get(params , cb);

参数​

params​

Object 型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
appId应用软件 IDstringtrue指定 @app 或应用软件的ID。
channelId频道 IDstringfalse指定频道的 ID。

cb​

function 型的参数。

说明​

详情请参见 ChatChannel API - RESTful API 。

mobage.api.chatMember.get​

获取Chat Member 所需的 API 。是Chat Member API - RESTful API的JavaScript 接口。

语法​

mobage.api. chatMember .get(params , cb);

参数​

params​

Object 型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
appId应用软件 IDstringtrue指定 @app 或应用软件的ID。
channelId频道 IDstringtrue指定频道的 ID。
idChat Member 的 idstringfalse指定Chat Member 对象的 ID。

cb​

function型的参数。

说明​

详情请参见ChatMember API - RESTful API。

mobage.api.chatMessage.get​

获取Chat Message 所需的 API 。是Chat Message API - RESTful API 的 JavaScript 接口。

语法​

mobage.api. chatMessage .get(params , cb);

参数​

params​

Object型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
appId应用软件 IDstringtrue指定 @app 或应用软件的ID。
channelId频道 IDstringtrue指定频道的 ID。
idChat Member 的 idstringfalse指定Chat Member 对象的 ID。

cb​

function型的参数。

说明​

详情请参见ChatMessage API - RESTful API。

mobage.api.userChatChannel.get​

获取User Chat Channel所需的 API 。是User Chat Channel API - RESTful API的JavaScript 接口。

语法​

mobage.api. userChatChannel .get(params , cb);

参数​

params​

Object型的参数。可设置如下所示的属性。

propertytitletyperequireddescription
userId用户 IDstringtrue指定 @me 或用户的 ID。
groupId群组 IDstringtrue指定 @self 。
channelId频道 IDstringfalse指定频道的 ID。

cb​

function型的参数。

说明​

详情请参见UserChatChannel API - RESTful API。