在字符串API中替换的引号

时间:2017-11-26 15:44:45

标签: vb.net api ebay zoho

我正在使用API​​调用来更新记录:

Dim TargetURL As String = "https://creator.zoho.com/api/json/" & myCfg.ZohoAPP & "/view/" & myCfg.ZohoReport & "?authtoken=" & myCfg.ZohoToken & "&scope=creatorapi&zc_ownername=" & myCfg.ZohoUser & "&criteria=(New_Ebay_Tracking_number==" & ebayNumber & ")&raw=true"
Dim httpReq As Object
httpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
httpReq.Open("GET", TargetURL, False)

所以在这部分我说用

更新
(New_Ebay_Tracking_number==" & ebayNumber & ")

如果我的ebayNumber只是数字,那就完美了。但是当我收到一封信时,它并没有起作用。

所以我将API调用更改为

(New_Ebay_Tracking_number==""" & ebayNumber & """)

但是那样我没有得到任何回应..

请记住,当我通过POSTMAN调用API时(New_Ebay_Tracking_number ==" 1234R")我得到了回复。但是,当我在我的代码中加上引号时,它不起作用。

整个发送请求方法

Try
            Dim TargetURL As String = "https://creator.zoho.com/api/json/" & myCfg.ZohoAPP & "/view/" & myCfg.ZohoReport & "?authtoken=" & myCfg.ZohoToken & "&scope=creatorapi&zc_ownername=" & myCfg.ZohoUser & "&criteria=(New_Ebay_Tracking_number==" & ebayNumber & ")&raw=true"
            Dim httpReq As Object
            httpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
            httpReq.Open("GET", TargetURL, False)
            httpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
            httpReq.send("")

            Dim response As String = httpReq.responseText

        Catch ex As Exception
            WriteLog("Error during check item on ZOHO " & ex.Message)
        End Try

0 个答案:

没有答案