C# Example to get all my contacts


I have the following C# console application and when I execute this, no result is shown. An error "Connection was lost" appears immediately.

Could you tell me what it´s wrong?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RestSharp;
using RestSharp.Authenticators;

namespace WrikeApiConsole
class Program
static void Main(string[] args)
var client = new RestClient("https://www.wrike.com/api/v4/contacts");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Content-Type", "application/json;charset=UTF-8");
request.AddHeader("Authorization", "Bearer my_permanent_token");
IRestResponse response = client.Execute(request);

Console.WriteLine("Content=" + response.Content.ToString());
Console.WriteLine("ErrorMessage=" + response.ErrorMessage);
Console.WriteLine("StatusCode=" + response.StatusCode);
Console.WriteLine("StatusDescription=" + response.StatusDescription);
Console.WriteLine("ResponseStatus=" + response.ResponseStatus);



1 comment
Spot On Innovative Approach Stellar Advice

Hi Rogelio Arosemena, happy to see you on the Community 🙂

If you still can't find the answer to this, I'd suggest reaching out to our support at https://help.wrike.com/hc/requests/new.

Please let me know if you have any other questions!

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

Lisa Wrike Team member Become a Wrike expert with Wrike Discover

Comment actions Permalink

Folllowing List for Post: C# Example to get all my contacts
[this list is visible for admins and agents only]

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