1
我试图发布数据回使用VB.NET的体位法的API,vb.net更新体位任务
我能够检索没有问题的数据,但我在努力获取数据回。以下是我试图更新任务中的笔记的例子。
Dim add As String = path + "tasks/" + t_id.Text
request = WebRequest.Create(add)
' Set the authentication
setauth()
' Set type to POST
request.Method = "POST"
request.KeepAlive = True
request.ContentType = "application/x-www-form-urlencoded"
data = "-d notes=" + t_notes.Text
byteData = UTF8Encoding.UTF8.GetBytes(data)
request.ContentLength = byteData.Length
'Write(data)
Try
ps = request.GetRequestStream()
ps.Write(byteData, 0, byteData.Length)
Finally
If Not ps Is Nothing Then ps.Close()
End Try
response = request.GetResponse()
我一直在404错误,但不知道我哪里出错。
感谢您的提示我已经将方法更改为PUT,并尝试将contenttype更改为application/json并通过请求发送为json字符串: - {“data”:{“notes”:blah blah}}但我没有收到错误的请求错误..你有任何提示吗? –
对不起,延迟回复(评论不会来到我的收件箱) - 你能告诉我你提出请求的路径吗?代码中“添加”变量的值。 –