I've been building a web api. It picks up the XML from the client. I can read the XML. I need to the data into Sage 300. Sage 300 seems to have a full Web API which I only just found out about. I can build JSON objects and post them. This is the code that posts to Sage:
public static async Task CreateCustomer(string uri, customersT customers)
{
var customer = new
{
CustomerNumber = customers.Items[0].custNo,
ShortName = customers.Items[0].custNo,
CustomerName = customers.Items[0].custAddresses[0].name,
GroupCode = "RTL"
};
await SendRequest(new HttpMethod("POST"), uri + @"AR/ARCustomers", customer);
}The code to post to Sage comes from a sample project. It required me to install 2 packages. Newtonsoft.Json and Microsoft.Net.Http. I did that but I get a warning and the post fails because think there is an incompatibility.
In the project Dependencies under NuGet Microsoft.Net.HTTP has a yellow triangle, as does Microsoft.Bcl. The warnings are:
1>E:\LSProjects\ACLWebApi\ACLWebApi\ACLWebApi.csproj : warning NU1701: Package 'Microsoft.Bcl 1.1.10' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. 1>E:\LSProjects\ACLWebApi\ACLWebApi\ACLWebApi.csproj : warning NU1701: Package 'Microsoft.Net.Http 2.2.29' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.
Any ideas on what I should do? In my mind, I'm just taking the XML and pulling out the data I want, constructing a JSON object and sending it, but I guess the post is failing due to the above warnings.
Any ideas on what packages I should install?