1

次の API リクエストのリクエスト ボディはどうすればよいですか?

API リクエスト
POST https://private-anon-xxxxxxxx-apify2prod.apiary-proxy.com/v2/actor-tasks/testttt~hedge-funds-scraper/run-sync?token=XXXXX

Request Headers
content-type: application/json
content-length: 18

Request Body
{
  "bar": "foo"
}

私の目標は、Apify API を使用してサーバー リクエストを送信することにより、タスクをリモートで実行することです。API 呼び出しで参照しているドキュメントは次のとおりです。

私が期待する結果は、タスクを手動で実行したときに取得したものと同じデータセットを含むサーバーの応答です。具体的には、そのデータセットは次のようになります。

期待される結果
[{
  "url": "https://en.wikipedia.org/wiki/List_of_hedge_funds",
  "pageTitle": "List of hedge funds - Wikipedia",
  "links": [
    {
      "firmName": "Bridgewater Associates",
      "firmUrl": "/wiki/Bridgewater_Associates",
      "hq": "Westport, CT",
      "hqUrl": "/wiki/United_States",
      "aum": "$132,050"
    },
    {
      "firmName": "Renaissance Technologies",
      "firmUrl": "/wiki/Renaissance_Technologies",
      "hq": "East Setauket, NY",
      "hqUrl": "/wiki/United_States",
      "aum": "$110,000"
    },
    {
      "firmName": "Man Group",
      "firmUrl": "/wiki/Man_Group",
      "hq": "London",
      "hqUrl": "/wiki/United_Kingdom",
      "aum": "$62,000"
    },
    {
      "firmName": "AQR Capital Management",
      "firmUrl": "/wiki/AQR_Capital_Management",
      "hq": "Greenwich, CT",
      "hqUrl": "/wiki/United_States",
      "aum": "$60,840"
    },
    {
      "firmName": "Two Sigma Investments",
      "firmUrl": "/wiki/Two_Sigma_Investments",
      "hq": "New York City, NY",
      "hqUrl": "/wiki/United_States",
      "aum": "$42,900"
    },
    {
      "firmName": "Millennium Management",
      "firmUrl": "/wiki/Millennium_Management,_LLC",
      "hq": "New York City, NY",
      "hqUrl": "/wiki/United_States",
      "aum": "$38,776"
    },
    {
      "firmName": "Elliott Management",
      "firmUrl": "/wiki/Elliott_Management",
      "hq": "New York City, NY",
      "hqUrl": "/wiki/United_States",
      "aum": "$37,769"
    },
    {
      "firmName": "BlackRock",
      "firmUrl": "/wiki/BlackRock",
      "hq": "New York City, NY",
      "hqUrl": "/wiki/United_States",
      "aum": "$32,909"
    },
    {
      "firmName": "Citadel LLC",
      "firmUrl": "/wiki/Citadel_LLC",
      "hq": "Chicago, IL",
      "hqUrl": "/wiki/United_States",
      "aum": "$32,243"
    },
    {
      "firmName": "Davidson Kempner Capital Management",
      "firmUrl": "/wiki/Davidson_Kempner_Capital_Management",
      "hq": "New York City, NY",
      "hqUrl": "/wiki/United_States",
      "aum": "$30,880"
    },
    {
      "firmName": "Viking Global Investors",
      "firmUrl": "/wiki/Viking_Global_Investors",
      "hq": "Greenwich, CT",
      "hqUrl": "/wiki/United_States",
      "aum": "$30,000"
    },
    {
      "firmName": "Baupost Group",
      "firmUrl": "/wiki/Baupost_Group",
      "hq": "Boston, MA",
      "hqUrl": "/wiki/United_States",
      "aum": "$28,900"
    },
    {
      "firmName": "D.E. Shaw & Co.",
      "firmUrl": "/wiki/D.E._Shaw_%26_Co.",
      "hq": "New York City, NY",
      "hqUrl": "/wiki/United_States",
      "aum": "$28,676"
    },
    {
      "firmName": "Farallon Capital",
      "firmUrl": "/wiki/Farallon_Capital",
      "hq": "San Francisco, CA",
      "hqUrl": "/wiki/United_States",
      "aum": "$27,600"
    },
    {
      "firmName": "Marshall Wace",
      "firmUrl": "/wiki/Marshall_Wace",
      "hq": "London",
      "hqUrl": "/wiki/United_Kingdom",
      "aum": "$27,100"
    },
    {
      "firmName": "The Children's Investment Fund Management",
      "firmUrl": "/wiki/The_Children%27s_Investment_Fund_Management",
      "hq": "London",
      "hqUrl": "/wiki/United_Kingdom",
      "aum": "$27,100"
    },
    {
      "firmName": "Wellington Management Company",
      "firmUrl": "/wiki/Wellington_Management_Company",
      "hq": "Boston, MA",
      "hqUrl": "/wiki/United_States",
      "aum": "$22,000"
    },
    {
      "firmName": "Winton Group",
      "firmUrl": "/wiki/Winton_Group",
      "hq": "London",
      "hqUrl": "/wiki/United_Kingdom",
      "aum": "$22,100"
    },
    {
      "firmName": "Capula Investment Management",
      "firmUrl": "/wiki/Capula_Investment_Management",
      "hq": "London",
      "hqUrl": "/wiki/United_Kingdom",
      "aum": "$19,800"
    },
    {
      "firmName": "York Capital Management",
      "firmUrl": "/wiki/York_Capital_Management",
      "hq": "New York City, NY",
      "hqUrl": "/wiki/United_States",
      "aum": "$18,500"
    }
  ]
}] 

以下は、私が得ている実際の結果のスクリーンショットです。201 応答コードと、次の応答本文の強調表示された部分に注意してください。

{ bar: 'foo' }

実結果

ここに画像の説明を入力

私は何を間違っていますか?リクエストの本文はどうすればよいですか?

4

1 に答える 1