我正在与Sheetlabs合作将 Google Sheet 转换为完整的 API。除了 Sheetlabs文档之外,我在网上找不到有用的信息时遇到了麻烦,因为此时它似乎是一项相当小的服务。
我在 Twilio 的自定义函数中使用 axios 将信息发布到我们的 Sheetlabs API。API 需要 HTTP 基本身份验证。
我在我的 axios 调用上尝试了各种变体,试图遵循Sheetlabs SwaggerHub 文档,但我的想法已经不多了。
const url = 'https://sheetlabs.com/records/{organization}/{dbName}';
const postData = {
trackingid: `${trackingUrl}`,
phonenumber: `${userPhoneNumber}`
}
const authParams = {
username: //sheetlabs email,
password: //access token
}
// axios function
axios.post(url, postData, {auth: authParams}).then(response => {
console.log('response: ', response);
}).catch(err => {
console.log('axios sheetlabs post error catch: ', err);
});
任何帮助将不胜感激。我会尽力为您提供您需要的任何其他信息。