I'm having trouble creating new Wrike tasks using VB.net and the Wrike API. I however, am able to connect to Wrike to GET a list of folders so I know I'm able to successfully authenticate.
Dim accessToken As String = API_Token
Dim apiVersion As String = "v4"
Dim ApiBaseUrl As String = "https://www.wrike.com"
Dim folderID As String = "Some Folder ID"
Dim address As String = ApiBaseUrl & "/api/" & apiVersion & "/folders/" & folderID & "/tasks"
Dim result As String
Dim task_str_ As String = "description=Test task description&title=Task Created With VS"
Dim request As HttpWebRequest = WebRequest.Create(address)
request.Headers.Add("Authorization", "Bearer " & accessToken)
request.Method = "POST"
request.ContentType = "application/json"
Using requestWriter2 As New StreamWriter(request.GetRequestStream())
Dim webResp As WebResponse = request.GetResponse()
Using reader = New StreamReader(webResp.GetResponseStream)
result = reader.ReadToEnd()
TextBox1.Text = (result)
Catch __unusedException1__ As Exception
TextBox1.Text = task_str_ & vbCrLf & vbCrLf & (__unusedException1__.ToString)
Here is the error I'm receiving:
System.Net.WebException: The remote server returned an error: (400) Bad Request
Please sign in to leave a comment.