I need nodejs code to create post request to make a fb page from url. Must code has error and I cant find it. The error message is Request failed with status code 400
. I dont include the accessToken string but it's existed in my real code.
我需要NodeJS代码来创建POST请求,以便从URL创建一个FB页面。必须代码有错误,我找不到它。错误消息为请求失败,状态代码为400。我没有包含accesToken字符串,但它存在于我的实际代码中。
import axios from "axios";
var form = {
name: "George The Great",
category: "1201",
category_enum: "SONG"
};
var options = {
url: `https://graph.facebook.com/v12.0/me/accounts?access_token=${accessToken}`,
method: 'post',
data: form,
headers: {
'content-type': 'application/json',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36',
}
}
axios.request(options).then(async(response) => {console.log(response.data) }).catch((error) => {console.error(error) });
The error message is Request failed with status code 400
.
错误消息为请求失败,状态代码为400。
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!