Woo Commerce Rest API为客户获取所有产品

时间:2018-11-27 10:28:27

标签: wordpress woocommerce wordpress-rest-api woocommerce-rest-api

我正在尝试使用承载令牌(使用JWT插件)获取所有产品。 使用管理员令牌可以提取所有产品,但是使用客户令牌时不能提取产品数据。

call: /wp-json/wc/v3/products

响应:

{
    "code": "woocommerce_rest_cannot_view",
    "message": "Sorry, you cannot list resources.",
    "data": {
        "status": 403
    }
}

img: click here to see image

2 个答案:

答案 0 :(得分:0)

只需在您的网络链接中使用https而不是http

答案 1 :(得分:-1)

尝试一下:

Const msiOpenDatabaseModeTransact = 1
Const msiViewModifyReplace = 4

Set installer = CreateObject("WindowsInstaller.Installer")
Set database = installer.OpenDatabase("Test.msi", msiOpenDatabaseModeTransact)

' Allow user to cancel operation
If MsgBox ("Only run this on a COPY of your MSI!" & vbNewLine & vbNewLine & "Continue?", vbYesNo + vbInformation, "Warning!") = vbNo Then
   MsgBox "Update Aborted.", vbOKOnly + vbInformation, "Aborted" 
   WScript.Quit(0)
End If

sql = "SELECT * FROM `Feature`"
Set view = database.OpenView(sql)
view.Execute()

Do
   Set record = view.Fetch()
   If record Is Nothing Then Exit Do
   record.IntegerData(6) = 0
   view.Modify msiViewModifyReplace, record
Loop

view.Close()
database.Commit()

MsgBox "Update Complete.", vbOKOnly + vbInformation, "Completed"

wc-api/v3/products. 更改为wp-json/wc