【发布时间】:2021-03-24 17:35:27
【问题描述】:
我正在尝试了解如何通过 API 调用自动从 WIX 导出我的数据。我知道这将是 JSON 格式,并且必须在 excel 中解析。
到目前为止,我在 wix 后端的 js 代码如下所示:
import { ok, notFound, serverError } from 'wix-http-functions';
import wixdatra from 'wixdata';
export function my_function() {
let options = {
"headers": {
"content-type": "application/Json"
}
};
return wixData.query("database table name")
.find()
.then(results => {
if (results.items.length > 0) {
options.body ={
"items": results.items
}
return ok(options);
}
}
}
我的 VB 代码如下所示:
Dim hReq As Object, Json As Dictionary
Dim sht As Worksheet
Dim authKey As String
authKey = "xxxkeyxxx"
Set sht = Sheet1
Dim strUrl As String
strUrl = "https:endpointurl"
Set hReq = CreateObject("MSXML2.XMLHTTP")
With hReq
.Open "GET", strUrl, False
.setRequestHeader "Authorization", authKey
.Send
End With
Dim response As String
response = hReq.ResponseText
MsgBox response
End Sub
我想这两个代码可能由于多种原因都是错误的,但我真的超出了我的深度!任何帮助将不胜感激。
【问题讨论】:
-
对于 2,从任何 API 文档开始。有吗?
-
你这是什么意思?我已经在 Wix 上设置了一个 API 密钥,我将尝试启用 http 功能并公开如下 Sam 提到的 API 密钥
标签: javascript vba api velo