ken_nogi/NodeJS/Care7_old/requestTest.js
Kenichiro NOGI 51a95c5e21 NodeJS
2025-07-10 10:12:37 +09:00

46 lines
1.2 KiB
JavaScript

//プリザンター実行変数
//const pleasanter = 'https://nextoffice.next-hd.co.jp/pleasanter';
const pleasanter = 'https://neo999.next-hd.net/pleasanter';
const apiKey = 'c38903157cbffc30961f50bc29d0991a6cd8af495ab3009b05c5f98e82b2e61b94ba2d5c0a48fc518b1cd74c9e427b01051a228f670f3c5282544dfbec93db87';
const uploadSiteId = "126841";
const siteId = "292812";
function main() {
const url = pleasanter + '/api/items/' + siteId + '/get';
console.log(url);
//送信データ
//let formData = new FormData();
let json = {
"ApiVersion": 1.1,
"ApiKey": apiKey,
};
//formData.append('parameters', json);
//console.log(formData);
fetch(url, {
"method": 'POST',
"body": JSON.stringify(json)
}).then((response) => {
if (!response.ok) {
throw new Error(`${response.status} ${response.statusText}`);
}
// レスポンスが JSON 形式で返っていることを想定
return response.json();
}).then((data) => {
console.log('** fetch: then(data)');
console.log(data.Response.Data);
}).catch((reason) => {
// エラー処理
console.log('** fetch: catch');
console.log(reason);
});
}
//始動
main();