C# Example to get all my contacts

Hi,

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");
//request.AddBody();
IRestResponse response = client.Execute(request);




if(response.IsSuccessful)
{
Console.WriteLine("Content=" + response.Content.ToString());
}
else
{
Console.WriteLine("ErrorMessage=" + response.ErrorMessage);
Console.WriteLine("StatusCode=" + response.StatusCode);
Console.WriteLine("StatusDescription=" + response.StatusDescription);
Console.WriteLine("ResponseStatus=" + response.ResponseStatus);
}

}

}
}

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

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 support@team.wrike.com.

Please let me know if you have any other questions!

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

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

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