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
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
1 commentaire

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/en-us/articles/25097464163607-Contact-Wrike-Customer-Support

Please let me know if you have any other questions!

Lisa Community Team at Wrike Wrike Product Manager Devenez un expert de Wrike avec Wrike Discover

Lisa Wrike Team member Devenez un expert de Wrike avec Wrike Discover

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

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

Haut

Prochaines sessions en direct