Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

spiresystems/spire-api-example-csharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spire API Example Using C#

Overview

This project intends to provide example usage of the Spire REST API using Microsoft .NET Framework 4.6. The project will build and run as is, and can be modified to suit your own requirements.

Example

Instantiate an API client with a company name, username, and password:

var client = new ApiClient("test", "username", "password");

Create a new inventory item:

var inventoryClient = new InventoryClient(client);

var inventory = new Inventory();
inventory.whse = "00";
inventory.partNo = "TESTPART";
inventory.type = InventoryType.Normal;
inventory.status = InventoryStatus.Active;
inventory.description = "Test Inventory";
inventory = inventoryClient.Create(inventory);

List inventory matching the query "TEST":

foreach (var i in inventoryClient.List(0, 100, "TEST"))
{
    Console.WriteLine(i.partNo);
}

Retrieve an inventory item by ID:

inventory = inventoryClient.Fetch(inventory.id);

Update a field on an existing inventory item:

inventory.description = "New Description";
inventoryClient.Update(inventory.id, inventory);

Delete an inventory item (if inventory is in use this will throw an ApiException):

inventoryClient.Delete(inventory.id);

Documentation

Please see the following for the most up-to-date documentation:

Releases

No releases published

Packages

No packages published

Languages