私は動的APIへのポストリクエストの返されたJSON結果に基づいてテーブルを生成するこのd3スクリプトを持っています。 APIには、このPOSTリクエストを実行すると、これは渡された入力パラメータ動作するように期待されている方法ですd3投稿要求にリクエスト本文を正しく渡す方法はありますか?
d3.request("https://erudite-master-api-awsmaui.lab.expts.net/erudite/search")
.header("Content-Type", "application/json")
.post("intent=data-quality", function (error,data){
function tabulate(data, columns) {
var table = d3.select('#response').append('table')
var thead = table.append('thead')
var tbody = table.append('tbody');
// append the header row
thead.append('tr')
.selectAll('th')
.data(columns).enter()
.append('th')
.text(function (column) { return column; });
// create a row for each object in the data
var rows = tbody.selectAll('tr')
.data(data)
.enter()
.append('tr');
console.log(data)
// create a cell in each row for each column
var cells = rows.selectAll('td')
.data(function (row) {
return columns.map(function (column) {
return {column: column, value: row[column]};
});
})
.enter()
.append('td')
.text(function (d) { return d.value; });
return table;
}
// render the table
tabulate(data, d3.keys(data[0]));
});
を、私はこのスクリプトを実行しているときしかし、私は400エラーコードを取得戻ってきた。リクエストボディを通過している可能性があることを私が知っていると思いますか?しかし100%確かではありません。どんな助けもありがとうございます。
はありがとう、 ".post(JSON.stringify(データ)は、" 私は必要なものです。 –