Customer Ship To
GET
using System;
using System.Threading.Tasks;
using Wdcs.Wip.Api;
using Wdcs.Wip.Client;
using Wdcs.Wip.Model;
namespace wip_project.Api
{
public partial class CustomerShipToService : IGetApi
{
/// <summary>
///
/// </summary>
/// <param name="apiUrl"></param>
/// <param name="username"></param>
/// <param name="password"></param>
/// <returns></returns>
public async Task GetAsync(string apiUrl, string username, string password)
{
var config = new Configuration()
{
BasePath = apiUrl
};
var tokenRequest = new TokenApi(config);
// Get the Token
var response = tokenRequest.Create(new TokenUser(username, password));
var authorization = "Bearer " + response.AuthToken;
// Instantiate API
var api = new CustomerShipToApi(config);
// Do a get from the server
var apiResponse = await api.GetAsync(authorization: authorization);
//
foreach (var shipTo in apiResponse.Results)
{
Console.WriteLine($"Customer: {shipTo.CustomerId} , Company Name: {shipTo.CompanyName}");
}
}
}
}