我真的不明白這個API應該如何工作,因爲我以前從未使用過JSON。幫助使用JSON的API
該文檔沒有給出任何示例,但它表示它在此API中的端點支持POST和GET操作,並返回JSON。
我的問題是,我不知道究竟是如何實現這一點,讓我們說我只想把所有的數據到一個簡單的頁面,比如這個:
市:塞勒姆
郵編:
等等
我不太肯定這個開始:
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
}
}
}
}
什麼你用來做這個請求的語言? –
[如何與Web XML/JSON APIs進行交互?](http://stackoverflow.com/questions/5503604/how-to-interface-with-web-xml-json-apis) – PleaseStand