API REST C# A trust relationship can not be established for the secure SSL / TLS channel

Hi,

I have a problem, when trying to consume the Epicor REST API, since visual studio generates the security error, if I make the same query from Postman, it works well, how can I also respond from visual studio?

PS: This is a translation by google translator

Either you need to have a valid certificate or you need to disable cert checking

1 Like

You may also be able to download the certificate and add it to the trusted sites cert storage on the pc you’re running it from.

Hi, @Chris_Conn

How can I get a valid certificate, is a test server

You can buy one or get one from Lets Encrypt… or you can just bypass the certificate checking

hi @josecgomez

How bypass the certificate checking?

i tried this

ServicePointManager.ServerCertificateValidationCallback += (senderC, cert, chain, sslPolicyErrors) => true;

yeah that shoudl work.

Server Error

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.

If you are getting that error in the browser then your issue is not just the Certificate.

I will explain all my problem.

If I reailize a GET request from the web browser, I get an answer.

If I file a POST petition from the postman, I get an answer

then from the postman, check the code, copy it and paste it in Visual

When I execute it

image

Run it with Fiddler and compare your C# request to the postman one.

Is it possible your URI isnt being properly built? - in debugger, you should be able to track that down

@josecgomez does this parameter look correct?
image

You might try temporarily excluding the parameter

Yeah… not sure you need to look at the Raw Request in Fiddler and compare it to the Raw Request from POSTMAN also in fiddler and you should immediately see the issue.

they had all the reason,

The problem was this:
https: //epicor102.crisalida.local/ERP102200/api/swagger/v1/methods

I change it for:
https: // epicor102 / ERP102200 / api / v1

and it works well

thank you very much to both