Rest User Authentication Error - Help

We are trying to pull a rest into a C# program and I keep getting user authentication errors with it. I read here that the username and password need to be encrypted:

I’m having a bit of trouble following the process of encrypting the username and password in a format that Epicor likes.

It depends on your endpoint definition in Epicor. Username and Password? Windows Auth? OAuth?

If you’re using Basic Auth (username and password) is just concatenate like this: {username}:{password} and Base64 encode it. This then goes in your header:

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

1 Like

Use a tool like Postman to test the calls. It helps remove unknowns.

1 Like


Do you have a program that converts the username and password to base64? I don’t know how to do that, unfortunately. Also, is the format {username}:{password} what I should use when I figure out how?

Just downloaded it. Never heard of this tool before. Thanks for the recommendation!

Have you checked out the Epicor REST Helper on Nuget?

It takes care of all the details for you.

1 Like

I was fighting it for a bit until I read the documentation and created an API Key. I am using Node.js and when I send that in the headers with authentication now everything works fine. Took the code right from Postman.


I have not. Ill get it installed and see what I can come up with! Thanks for the help!

So I can get Postman to pull the information I need. Now I need to find the section that shows how it was pulled.

Postman will create the header for Authentication. You can copy the value into your code.

Jason Woods

Trying to find a list of commands that comes with the Rest Helper, does anyone have one? Also will I be able to utilize this fully being on gov cloud?

Here’s some documentation for it

And yes you can use it with any instance of Epicor as long as REST is available.

You’ll have to forgive my lack of knowledge on this subject. What I want to do is pull in the baq results into a c# program. The program I had made before would always bounce on authentication. I got post man to post out correctly and it gave me an authentication key to use instead. I see how to add a username and a password but how do I add the key? Also, do we put in under the AppPoolHost?

Thanks for the help thus far!

This is the code I have thus far:

I get the following error when I run the program:

Anyone know how to get around that error?

I think dic needs to have your BAQ parameters. Also make sure “APOTool2” is the correct BAQ ID, and is on the server you are targeting, and can be run by the user you are using for the REST call.

Edit: Also try the non-JSON variant GetBAQResults and see if that gives you an error.

Oh, I just remembered I think @josecgomez said those were deprecated anyway:

So in this case the BAQ is to be run wide open. What parameters would I need to add to get it to do? As for the BAQ id it is accurate and accessible for the individual.

Yeah use dynamic we are working on cleaning up that library for next release

var result = EpicorRest.DynamicGet("BaqSvc", "APOTool2", new Dictionary<string, string>());

result will be a dynamic object with the results of the BAQ.

1 Like

@Evan_Purdy @josecgomez ,
I changed the line for the one you gave me I still get the same error.

I have to wonder if I’m putting in the AppPoolHost wrong. Could you tell me where to pull it from?