Skip to content

The official ShipEngine™ C# Client for communicating with the worlds best multi-carrier shipping API.

Notifications You must be signed in to change notification settings

multiarc/shipengine-csharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShipEngine.ApiClient - the C# library for the ShipEngine™

Nuget Installation

We're listed on Nuget for installation, simply find us in the package explorer, or install us using the Package Manager Console.

Install-Package ShipEngine.ApiClient

Frameworks supported

  • .NET 4.0 or later
  • Windows Phone 7.1 (Mango)

Dependencies

The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using ShipEngine.ApiClient.Api;
using ShipEngine.ApiClient.Client;
using ShipEngine.ApiClient.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out ShipEngine.ApiClient.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Getting Started

using System;
using System.Diagnostics;
using ShipEngine.ApiClient.Api;
using ShipEngine.ApiClient.Client;
using ShipEngine.ApiClient.Model;

namespace Example
{
    public class Example
    {
        public void main()
        {

            // Configure API key authorization: api-key
            Configuration.Default.ApiKey.Add("api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // Configuration.Default.ApiKeyPrefix.Add("api-key", "Bearer");

            var apiInstance = new AddressValidationApi();
            var addresses = new List<AddressDTO>(); // List<AddressDTO> | 
            var apiKey = apiKey_example;  // string | API Key (default to jHpriMLAiP0f8PszTUn37t4D3+q2lW/G+eaMgGAupBY)

            try
            {
                List<AddressValidationResponseDTO> result = apiInstance.AddressValidationValidateAddresses(addresses, apiKey);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AddressValidationApi.AddressValidationValidateAddresses: " + e.Message );
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.shipengine.com

Class Method HTTP request Description
AddressValidationApi AddressValidationValidateAddresses POST /v1/addresses/validate
BatchesApi BatchesAddToBatch POST /v1/batches/{batch_id}/add
BatchesApi BatchesCreate POST /v1/batches
BatchesApi BatchesGet GET /v1/batches/{batch_id}
BatchesApi BatchesGetByExternalId GET /v1/batches/external_batch_id/{external_batch_id}
BatchesApi BatchesList GET /v1/batches
BatchesApi BatchesListErrors GET /v1/batches/{batch_id}/errors
BatchesApi BatchesProcess POST /v1/batches/{batch_id}/process/labels
BatchesApi BatchesRemoveFromBatch POST /v1/batches/{batch_id}/remove
CarrierAccountsApi AccessWorldwideAccountCarrierConnectAccount POST /v1/connections/carriers/access_worldwide
CarrierAccountsApi AccessWorldwideAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/access_worldwide/{carrier_id}
CarrierAccountsApi ApcAccountCarrierConnectAccount POST /v1/connections/carriers/apc
CarrierAccountsApi ApcAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/apc/{carrier_id}
CarrierAccountsApi AsendiaAccountCarrierConnectAccount POST /v1/connections/carriers/asendia
CarrierAccountsApi AsendiaAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/asendia/{carrier_id}
CarrierAccountsApi DHLExpressAccountCarrierConnectAccount POST /v1/connections/carriers/dhl_express
CarrierAccountsApi DHLExpressAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/dhl_express/{carrier_id}
CarrierAccountsApi DHLExpressAccountCarrierUpdateSettings PUT /v1/connections/carriers/dhl_express/{carrier_id}/settings
CarrierAccountsApi EndiciaAccountCarrierConnectAccount POST /v1/connections/carriers/endicia
CarrierAccountsApi EndiciaAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/endicia/{carrier_id}
CarrierAccountsApi FedExAccountCarrierConnectAccount POST /v1/connections/carriers/fedex
CarrierAccountsApi FedExAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/fedex/{carrier_id}
CarrierAccountsApi FedExAccountCarrierUpdateSettings PUT /v1/connections/carriers/fedex/{carrier_id}/settings
CarrierAccountsApi FirstMileAccountCarrierConnectAccount POST /v1/connections/carriers/firstmile
CarrierAccountsApi FirstMileAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/firstmile/{carrier_id}
CarrierAccountsApi GlobegisticsAccountCarrierConnectAccount POST /v1/connections/carriers/globegistics
CarrierAccountsApi GlobegisticsAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/globegistics/{carrier_id}
CarrierAccountsApi ImexAccountCarrierConnectAccount POST /v1/connections/carriers/imex
CarrierAccountsApi ImexAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/imex/{carrier_id}
CarrierAccountsApi NewgisticsAccountCarrierConnectAccount POST /v1/connections/carriers/newgistics
CarrierAccountsApi NewgisticsAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/newgistics/{carrier_id}
CarrierAccountsApi NewgisticsAccountCarrierUpdateSettings PUT /v1/connections/carriers/newgistics/{carrier_id}/settings
CarrierAccountsApi OnTracAccountCarrierConnectAccount POST /v1/connections/carriers/ontrac
CarrierAccountsApi OnTracAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/ontrac/{carrier_id}
CarrierAccountsApi RrDonnelleyAccountCarrierConnectAccount POST /v1/connections/carriers/rr_donnelley
CarrierAccountsApi RrDonnelleyAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/rr_donnelley/{carrier_id}
CarrierAccountsApi StampsAccountCarrierConnectAccount POST /v1/connections/carriers/stamps_com
CarrierAccountsApi StampsAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/stamps_com/{carrier_id}
CarrierAccountsApi UPSAccountCarrierConnectAccount POST /v1/connections/carriers/ups
CarrierAccountsApi UPSAccountCarrierDisconnectAccount DELETE /v1/connections/carriers/ups/{carrier_id}
CarrierAccountsApi UPSAccountCarrierUpdateSettings PUT /v1/connections/carriers/ups/{carrier_id}/settings
CarriersApi CarriersAddFunds PUT /v1/carriers/{carrier_id}/add_funds
CarriersApi CarriersGet GET /v1/carriers/{carrier_id}
CarriersApi CarriersGetOptions GET /v1/carriers/{carrier_id}/options
CarriersApi CarriersList GET /v1/carriers
CarriersApi CarriersListPackages GET /v1/carriers/{carrier_id}/packages
CarriersApi CarriersListServices GET /v1/carriers/{carrier_id}/services
EnvironmentApi EnvironmentCreateWebhook POST /v1/environment/webhooks
EnvironmentApi EnvironmentDeleteWebhook DELETE /v1/environment/webhooks/{webhook_id}
EnvironmentApi EnvironmentGetWebhookById GET /v1/environment/webhooks/{webhook_id}
EnvironmentApi EnvironmentUpdateWebhook PUT /v1/environment/webhooks/{webhook_id}
EnvironmentApi EnvironmentWebhooks GET /v1/environment/webhooks
EnvironmentApi EnvironmentWhoami GET /v1/environment/whoami
InsuranceApi InsuranceAddFunds PATCH /v1/insurance/shipsurance/add_funds
InsuranceApi InsuranceGetBalance GET /v1/insurance/shipsurance/balance
LabelsApi LabelsGet GET /v1/labels/{label_id}
LabelsApi LabelsList GET /v1/labels
LabelsApi LabelsPurchaseLabel POST /v1/labels
LabelsApi LabelsPurchaseLabelWithRate POST /v1/labels/rates/{rate_id}
LabelsApi LabelsPurchaseLabelWithShipment POST /v1/labels/shipment/{shipment_id}
LabelsApi LabelsTrack GET /v1/labels/{label_id}/track
LabelsApi LabelsVoidLabel PUT /v1/labels/{label_id}/void
ManifestsApi ManifestsCreate POST /v1/manifests
ManifestsApi ManifestsGet GET /v1/manifests/{manifest_id}
ManifestsApi ManifestsList GET /v1/manifests
PackagesApi PackagesCreate POST /v1/packages
PackagesApi PackagesDelete DELETE /v1/packages/{package_id}
PackagesApi PackagesGet GET /v1/packages/{package_id}
PackagesApi PackagesList GET /v1/packages
PackagesApi PackagesUpdate PUT /v1/packages/{package_id}
RatesApi RatesEstimate POST /v1/rates/estimate
RatesApi RatesGet GET /v1/rates/{rate_id}
RatesApi RatesRateShipment POST /v1/rates
RatesApi RatesRateShipmentsAsync POST /v1/rates/bulk
ShipmentsApi ShipmentsAddTag POST /v1/shipments/{shipment_id}/tags/{tag}
ShipmentsApi ShipmentsCancel PUT /v1/shipments/{shipment_id}/cancel
ShipmentsApi ShipmentsCreateShipments POST /v1/shipments
ShipmentsApi ShipmentsGet GET /v1/shipments/{shipment_id}
ShipmentsApi ShipmentsGetByExternalId GET /v1/shipments/external_shipment_id/{external_shipment_id}
ShipmentsApi ShipmentsGetRatesForShipment GET /v1/shipments/{shipment_id}/rates
ShipmentsApi ShipmentsList GET /v1/shipments
ShipmentsApi ShipmentsListErrors GET /v1/shipments/{shipment_id}/errors
ShipmentsApi ShipmentsRemoveTag DELETE /v1/shipments/{shipment_id}/tags/{tag}
ShipmentsApi ShipmentsUpdateShipment PUT /v1/shipments/{shipment_id}
TagsApi TagsAddTag POST /v1/tags/{tag_name}
TagsApi TagsDelete DELETE /v1/tags/{tag_name}
TagsApi TagsListTags GET /v1/tags
TagsApi TagsUpdateTag PUT /v1/tags/{tag_name}/{new_name}
TrackingApi TrackingStartTracking POST /v1/tracking/start
TrackingApi TrackingStopTracking POST /v1/tracking/stop
TrackingApi TrackingTrack GET /v1/tracking
WarehousesApi WarehousesCreate POST /v1/warehouses
WarehousesApi WarehousesDelete DELETE /v1/warehouses/{warehouse_id}
WarehousesApi WarehousesGet GET /v1/warehouses/{warehouse_id}
WarehousesApi WarehousesList GET /v1/warehouses
WarehousesApi WarehousesUpdate PUT /v1/warehouses/{warehouse_id}

Documentation for Models

Documentation for Authorization

api-key

  • Type: API key
  • API key parameter name: api-key
  • Location: HTTP header

About

The official ShipEngine™ C# Client for communicating with the worlds best multi-carrier shipping API.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages