Creating new tasks with the Wrike API and VB.net

 

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.

 

```VB.Net

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"
Try
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())
requestWriter2.Write(task_str_)
End Using
Dim webResp As WebResponse = request.GetResponse()
Using reader = New StreamReader(webResp.GetResponseStream)
result = reader.ReadToEnd()
End Using
TextBox1.Text = (result)
Catch __unusedException1__ As Exception
TextBox1.Text = task_str_ & vbCrLf & vbCrLf & (__unusedException1__.ToString)
End Try

```

Here is the error I'm receiving:

System.Net.WebException: The remote server returned an error: (400) Bad Request

0
1 комментарий
Spot On Innovative Approach Stellar Advice
Avatar

Hi Nicholas, welcome to the Community, happy to see you here 🙂

Please let me know if you'd like me to raise a Support ticket for you, I'll be happy to assist 🙌

Lisa Community Team at Wrike Become a Wrike expert with Wrike Discover

0
Действия с комментариями Постоянная ссылка

Folllowing List for Post: Creating new tasks with the Wrike API and VB.net
[this list is visible for admins and agents only]

Didn’t find what you were looking for? Write new post