0

JSON を扱ったことがないので、この API がどのように機能するのかよくわかりません。

ドキュメントには例が示されていませんが、この API のエンドポイントは POST 操作と GET 操作の両方をサポートし、JSON を返すと書かれています。

私の質問は、これを実装する方法が正確にはわかりません。たとえば、すべてのデータを次のような単純なページに取り込みたいとしましょう。

都市: セーラム

郵便番号: 97302

等...

どこから始めればよいかよくわかりません:

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
    }
}
}
}
4

3 に答える 3

2

URL はエンティティを説明します。

http://[your RepMan hostname]/api/v1/account/reputation/current.json - ユーザーの現在の評判

HTTP GETを使用して、エンティティに関するデータを取得 (取得)できます。

HTTP POSTを使用すると、エンティティに関するデータを API に送信(投稿)できます (新しいエンティティを更新または作成します)。

これを行うには、次のような他の多くの場所で説明されているように curl を使用するだけです: php: Get url content (json) with cURL

于 2013-05-28T18:02:10.637 に答える