Thanks Smith
My current version is Epicor Kinetic.
I based on the steps to install and execute. After run, it show this error. Where can I find a document that can do a basic testing.
Step 1: Prepare the Environment
Install .NET SDK
Ensure that the .NET SDK is installed on your system. You can download and install it from Microsoft’s official website.
Create a New Project
Open the command prompt or terminal and run the following command to create a new C# console application:
bash
Copy
dotnet new console -n EpicorKineticSalesOrderSummary
cd EpicorKineticSalesOrderSummary
Step 2: Write the Code
Open the Program.cs File
Open the Program.cs file using your preferred text editor or IDE (such as Visual Studio or Visual Studio Code).
Replace the Code
Copy and paste the following code into Program.cs:
csharp
Copy
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace EpicorKineticSalesOrderSummary
{
class Program
{
static async Task Main(string[] args)
{
// Replace with the actual Epicor Kinetic API base URL
string baseUrl = "https://your-epicor-kinetic-server/erp/api/v1/salesordersummary";
string customerCode = "CUSTOMER_CODE"; // Replace with the actual customer code
using (HttpClient client = new HttpClient())
{
client.BaseAddress = new Uri(baseUrl);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// If authentication is required, add the authorization header
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "YOUR_ACCESS_TOKEN");
string requestUri = $"?customerCode={customerCode}";
try
{
HttpResponseMessage response = await client.GetAsync(requestUri);
if (response.IsSuccessStatusCode)
{
string jsonResult = await response.Content.ReadAsStringAsync();
Console.WriteLine("Sales Order Summary:");
Console.WriteLine(jsonResult);
}
else
{
Console.WriteLine($"Error: {response.StatusCode} - {response.ReasonPhrase}");
}
}
catch (Exception ex)
{
Console.WriteLine("An error occurred while retrieving the Sales Order summary: " + ex.Message);
}
}
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
Step 3: Update Configuration
Update the Base URL
Change the value of baseUrl
to the REST API endpoint of your Epicor Kinetic server.
Set the Customer Code
Replace customerCode
with the actual customer code you want to query.
Authentication (if needed)
If the server requires an access token or other authentication details, add or modify the HTTP request headers as necessary.
Step 4: Build and Run the Application
Build the Application
In the command prompt, run the following command to build the application:
bash
Copy
dotnet build
Run the Application
Use the following command to run the application:
bash
Copy
dotnet run
Step 5: View the Results
The application will display the JSON response returned by the Epicor Kinetic Sales Order Summary API.
These steps should help you set up and execute the C# console application on Epicor. If you have any questions or need further assistance, feel free to ask!