I am trying to Authenticate in Orchestrator via c# app with RestSharp library.
In postman everything works just fine and I am retrieving the auth. token.
But in my app I got empty response with response code 0.
I used the code snipped generated by Postman so the parameters should be the same.
When I tried another POST call to different API, everything worked fine, problem is only with the Orchestrator.
This is part of my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RestSharp;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var client = new RestClient("https://orchestratorURL/api/account/authenticate");
var request = new RestRequest(Method.POST);
request.AddHeader("Postman-Token", "xx");
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\n \"tenancyName\": \"xx\",\n \"usernameOrEmailAddress\": \"xx\",\n \"password\": \"xx\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Console.ReadLine();
}
}
}
Any ideas what am I doing wrong? I am very new to c# and quite new to APIs in general.
Thanks)
Thanks Aksh, I tried your code and I still don´t see the response (token) in my console.
Did you manage to see it when you provide your Orchestrator details?
It works fine on the https://platform.uipath.com, but it doesn´t on our instalation. Probably will be some problem with the infrastructure (firewalls etc).
Anyway thanks a lot for your help, you saved the day)