【发布时间】:2019-10-24 16:12:49
【问题描述】:
我有一个 Wix 网站,我正在尝试向移动应用程序发出 API 请求
我有一个名为 Stores 的数据库,其中有一个名为 Products 的集合
我的问题是如何发出获取请求以获取集合 Products 中的所有值? 我下面的代码不工作
http-functions.js
import {ok, notFound, serverError} from 'wix-http-functions';
import wixData from 'wix-data';
export function get_example(request) {
const response = {
"headers": {
"Content-Type": "application/json"
}
};
return wixData.query("Products")
.find()
.then(
result=> {
response.body = {
"items": result.items
};
return ok(response);
}
)
}
我收到此错误
{"error":{"name":"Error","errorGroup":"User","code":"WD_VALIDATION_ERROR"}}
【问题讨论】:
标签: velo