我正在尝试使用VB.NET、将数据发布回Asana Api
我能够毫无问题地检索数据,但很难将数据取回。下面是我尝试在任务中更新笔记的示例。
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错误,但不确定哪里出了问题。
(我在Asana工作)
如果要更新任务,应该使用PUT HTTP方法,而不是POST。