我正在使用Chilkat对象,并希望能够将PATCH JSON字符串发送到vbscript中的URL端点。我的POST运作良好,但是,我似乎找不到发送PATCH的方法。发送POST的电话是: 设置resp = http.PostJson(URL,ResultStr)。如何使用类似的Chilkat方法发送PATCH JSON字符串?下面是我的代码:
ResultStr = BuildJSONUpdatedResults()
set http = CreateObject("Chilkat_9_5_0.Http")
success = http.AddQuickHeader("content-type","application/json")
success = http.AddQuickHeader("Authorization",auth)
set resp = http.PostJson(URL, ResultStr)
非常感谢。
答案 0 :(得分:2)
改用 REST 对象。
loRest.AddHeader("Content-Type","application/json")
loRest.AddHeader("Authorization","Bearer "+this.token)
loRest.AddHeader("X-Upload-Content-Type",this.contentType)
loJson.UpdateString("name",this.remoteFile)
set lcResponseStr = loRest.FullRequestString("PATCH", "/upload/drive/v3/files/"+fileToBeUpdated+"?uploadType=resumable, loJson.emit)
答案 1 :(得分:0)
您应改为调用PText,如下所示:
set resp = http.PText("PUT",URL,ResultStr,"utf-8","application/json", 0, 0)