API 実装のテスト方法

  1. Package Explorer で、プロジェクト名を右クリックし、[Run As (別のユーザとして実行)] > [Mule Application (Mule アプリケーション)] を選択します。

  2. ブラウザを開き、http://localhost:8081/placeholder に移動します。

    JSONPlaceholder サービスからのすべてのユーザ情報が表示されます。

    [
       {
          "id": 1,
          "name": "Leanne Graham",
          "username": "Bret",
          "email": "Sincere@april.biz",
          "address": {
            "street": "Kulas Light",
            "suite": "Apt. 556",
            "city": "Gwenborough",
            "zipcode": "92998-3874",
            "geo": {
              "lat": "-37.3159",
              "lng": "81.1496"
    
        ...
        {
        "id": 10,
        "name": "Clementina DuBuque",
        "username": "Moriah.Stanton",
        "email": "Rey.Padberg@karina.biz",
        "address": {
          "street": "Kattie Turnpike",
          "suite": "Suite 198",
          "city": "Lebsackbury",
          "zipcode": "31428-2261",
          "geo": {
            "lat": "-38.2386",
            "lng": "57.2232"
          }
    ...
    ]
  3. ID = 4 のユーザのみに関するユーザ情報を取得します。http://localhost:8081/placeholder/byid?id=4 に移動します。

    [
      {
        "id": 4,
        "name": "Patricia Lebsack",
        "username": "Karianne",
        "email": "Julianne.OConner@kory.org",
        "address": {
          "street": "Hoeger Mall",
          "suite": "Apt. 692",
          "city": "South Elvis",
          "zipcode": "53919-4257",
          "geo": {
            "lat": "29.4572",
            "lng": "-164.2990"
          }
        },
        "phone": "493-170-9623 x156",
        "website": "kale.biz",
        "company": {
          "name": "Robel-Corkery",
          "catchPhrase": "Multi-tiered zero tolerance productivity",
          "bs": "transition cutting-edge web services"
        }
      }
    ]
  4. ユーザの名前のみを取得します。http://localhost:8081/placeholder/names に移動します。

    [
      "Leanne Graham",
      "Ervin Howell",
      "Clementine Bauch",
      "Patricia Lebsack",
      "Chelsey Dietrich",
      "Mrs. Dennis Schulist",
      "Kurtis Weissnat",
      "Nicholas Runolfsdottir V",
      "Glenna Reichert",
      "Clementina DuBuque"
    ]

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub