Lightspeed Retail API调用Google App脚本,无效的参数错误

问题描述

我有一个Google App脚本,用于检查Lightspeed帐户中的购买情况,请参见下面的代码。该代码正常运行,但URL中的最后一个参数除外(&or = voided%3Dtrue | completed%3Dtrue)。当我在Postman中使用这些确切的参数时,一切都正常运行,我只会得到无效(取消)或已完成的销售。在GAS中,我从Lightspeed API返回以下错误: {“ httpCode”:“ 400”,“ httpMessage”:“ Bad Request”,“ message”:“ findAllByFieldMatch获得了” voided = true“的搜索。您的意思是:void吗?”,“ errorClass”:“ Exception”}

当我尝试使用其他选项对这些参数进行URL编码时,我从GAS收到无效的参数错误。我在这里完全感到困惑,有人知道我在GAS中做错了什么吗?

//Call the Lightspeed API
const accesstoken = auth();
const urlRaw = `https://api.lightspeedapp.com/API/Account/${accountid}/Sale.json?load_relations=["Customer.Contact","SalePayments.PaymentType"]&updateTime=>,${timestamp}&or=voided%3Dtrue|completed%3Dtrue`
let url = encodeURI(urlRaw);

const payload = {     
    "method": "GET","headers": {
        "Authorization": "Bearer " + accesstoken
    },};

const dataraw = UrlFetchApp.fetch(url,payload);
const data = JSON.parse(dataraw);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)