Sage100.ApiClient 1.9.0

An async API service client based on the Sage 100 Office 365 connector.

There is a newer version of this package available.
See the version list below for details.
Install-Package Sage100.ApiClient -Version 1.9.0
dotnet add package Sage100.ApiClient --version 1.9.0
<PackageReference Include="Sage100.ApiClient" Version="1.9.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sage100.ApiClient --version 1.9.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Example Code

using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Sage100.ApiClient;
using Sage100.ApiClient.Models.Contact;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;

namespace Example
{
    class Program
    {
        /* Replace with the client id of your own Azure native application */
        private const string ClientId = "9012432f-43fe-4adf-9271-aa87d2c16e97";
        private const string RedirectUri = "https://localhost";
        private const string CompanyCode = "ABC";

        /// <summary>
        /// WinMain entry point.
        /// </summary>
        /// <param name="args">The command line arguments.</param>
        static void Main(string[] args)
        {
            var configuration = ServiceClient.GetConfiguration(ClientId, RedirectUri, new PlatformParameters(PromptBehavior.SelectAccount)).Result;
            var client = new ServiceClient(configuration, new Func<PlatformParameters>(() => { return new PlatformParameters(PromptBehavior.Auto); }));

            var name = client.V1.Companies[CompanyCode].Customers.FindAsync("american busin").Result.FirstOrDefault();

            Debug.WriteLine(name);

            var customer = client.V1.Companies[CompanyCode].Customers[name.Id].GetAsync();
            var contacts = client.V1.Companies[CompanyCode].Customers[name.Id].Contacts.GetAsync();
            var memos = client.V1.Companies[CompanyCode].Customers[name.Id].Memos.GetAsync();
            var invoices = client.V1.Companies[CompanyCode].Customers[name.Id].Invoices.GetAsync();
            var payments = client.V1.Companies[CompanyCode].Customers[name.Id].Payments.GetAsync();

            var tasks = new List<Task>
            {
                customer,
                contacts,
                memos,
                invoices,
                payments
            };

            Task.WaitAll(tasks.ToArray());

            var contact = contacts.Result.FirstOrDefault();
            var memo = memos.Result.FirstOrDefault();
            var invoice = invoices.Result.FirstOrDefault();
            var payment = payments.Result.FirstOrDefault();

            Debug.WriteLine(contact);
            Debug.WriteLine(memo);
            Debug.WriteLine(invoice);
            Debug.WriteLine(payment);

            tasks.Clear();

            tasks.Add(client.V1.Companies[CompanyCode].Customers[name.Id].Invoices[invoice.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].Customers[name.Id].Memos[memo.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].Customers[name.Id].Payments[payment.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerContacts[contact.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerMemos[memo.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerInvoices[invoice.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerPayments[payment.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerContacts[contact.Id].Memos.GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerContacts[contact.Id].Memos[memo.Id].GetAsync());

            Task.WaitAll(tasks.ToArray());

            var patch = new ContactPatchEntity()
            {
                Salutation = "Mr.",
                Title = "President"
            };

            patch.Extension.Add("FaxNo", "714-785-4718");

            var c = client.V1.Companies[contact.Company].CustomerContacts[contact.Id].UpdateAsync(patch).Result;
        }
    }
}

Example Code

using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Sage100.ApiClient;
using Sage100.ApiClient.Models.Contact;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;

namespace Example
{
    class Program
    {
        /* Replace with the client id of your own Azure native application */
        private const string ClientId = "9012432f-43fe-4adf-9271-aa87d2c16e97";
        private const string RedirectUri = "https://localhost";
        private const string CompanyCode = "ABC";

        /// <summary>
        /// WinMain entry point.
        /// </summary>
        /// <param name="args">The command line arguments.</param>
        static void Main(string[] args)
        {
            var configuration = ServiceClient.GetConfiguration(ClientId, RedirectUri, new PlatformParameters(PromptBehavior.SelectAccount)).Result;
            var client = new ServiceClient(configuration, new Func<PlatformParameters>(() => { return new PlatformParameters(PromptBehavior.Auto); }));

            var name = client.V1.Companies[CompanyCode].Customers.FindAsync("american busin").Result.FirstOrDefault();

            Debug.WriteLine(name);

            var customer = client.V1.Companies[CompanyCode].Customers[name.Id].GetAsync();
            var contacts = client.V1.Companies[CompanyCode].Customers[name.Id].Contacts.GetAsync();
            var memos = client.V1.Companies[CompanyCode].Customers[name.Id].Memos.GetAsync();
            var invoices = client.V1.Companies[CompanyCode].Customers[name.Id].Invoices.GetAsync();
            var payments = client.V1.Companies[CompanyCode].Customers[name.Id].Payments.GetAsync();

            var tasks = new List<Task>
            {
                customer,
                contacts,
                memos,
                invoices,
                payments
            };

            Task.WaitAll(tasks.ToArray());

            var contact = contacts.Result.FirstOrDefault();
            var memo = memos.Result.FirstOrDefault();
            var invoice = invoices.Result.FirstOrDefault();
            var payment = payments.Result.FirstOrDefault();

            Debug.WriteLine(contact);
            Debug.WriteLine(memo);
            Debug.WriteLine(invoice);
            Debug.WriteLine(payment);

            tasks.Clear();

            tasks.Add(client.V1.Companies[CompanyCode].Customers[name.Id].Invoices[invoice.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].Customers[name.Id].Memos[memo.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].Customers[name.Id].Payments[payment.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerContacts[contact.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerMemos[memo.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerInvoices[invoice.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerPayments[payment.Id].GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerContacts[contact.Id].Memos.GetAsync());
            tasks.Add(client.V1.Companies[CompanyCode].CustomerContacts[contact.Id].Memos[memo.Id].GetAsync());

            Task.WaitAll(tasks.ToArray());

            var patch = new ContactPatchEntity()
            {
                Salutation = "Mr.",
                Title = "President"
            };

            patch.Extension.Add("FaxNo", "714-785-4718");

            var c = client.V1.Companies[contact.Company].CustomerContacts[contact.Id].UpdateAsync(patch).Result;
        }
    }
}

Release Notes

Initial release of the Sage 100 API service client.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.7.0 86 10/24/2019
2.4.0 164 1/30/2019
2.2.0 161 10/25/2018
1.9.0 214 9/19/2018