我真的不明白这个 API 应该如何工作,因为我以前从未使用过 JSON。
该文档没有提供任何示例,但它说此 API 中的端点支持 POST 和 GET 操作,返回 JSON。
我的问题是,我不确定如何实现这一点,假设我只想将所有数据提取到一个简单的页面中,例如:
城市: 塞勒姆
邮编: 97302
ETC...
我不太确定从哪里开始:
POST http://[您的 RepMan 主机名]/api/v1/account/reputation/current.json
GET http://[您的 RepMan 主机名]/api/v1/account/reputation/current.json
以下是 POST 正文或 GET 查询字符串的参数列表。所有值都应按照正常的 POST 正文或 GET 查询字符串进行正确编码。
| Field | Ordinality | Datatype | Description
| pid | 1 | string | This is your partner ID as provided by us to access the API.
| apiKey | 1 | string | This is your API Key as provided by use to access the API.
| srid | ? | string | This is the unique RepMan ID for the account. Either this or customerId must be specified.
| customerId | ? | string | This is your unique customer id for the account. Either this or srid must be specified.
对于 200 响应,您将收到以下 JSON 内容:
{
account : {
srid : "DW5SRB36",
lastName : "Morimoto",
pid : "SRP",
customerId : null,
firstName : "Masaharu"
},
company : {
city : "New York",
postalZip : "10011",
provState : "NY",
name : "Morimoto",
address : "88 10th Ave"
},
visibility : {
found : 18,
missing : 9
},
reviews : {
1star : 5,
4star : 37,
3star : 44,
5star : 66,
2star : 5
},
competition : {
Restaurants in New York : {
Megu : 1.82,
Morimoto: 52.95,
Matsuri : 18.13,
Buddakan: 0.93,
Nobu : 26.17
}
},
social : {
checkins : 5015,
twitter_followers : 8154,
facebook_likes : 1134
},
mentions : {
07-09-2011 : {
positive : 0,
neutral : 0,
negative : 0
},
07-07-2011: {
positive : 2,
neutral : 3,
negative : 0
},
07-05-2011: {
positive : 1,
neutral : 2,
negative : 0
},
07-11-2011: {
positive : 2,
neutral : 2,
negative : 0
},
07-06-2011: {
positive : 5,
neutral : 2,
negative : 0
},
07-10-2011: {
positive : 3,
neutral : 4,
negative : 0
},
07-08-2011: {
positive : 1,
neutral : 5,
negative : 0
}
}
}
}