Skip to content

sar0z/SendCloudApi.Net

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SendCloudApi.Net

An unofficial client for the SendCloud API. More info about SendCloud on http://sendcloud.nl. Below are some examples on the usage of this client.

Full docs of the SendCloud API can be found on https://docs.sendcloud.sc/api/v2/index.html

Installation

This project can easily be installed through NuGet.

Install-Package SendCloudApi

Set-up connection

Prepare the client for connecting to SendCloud with your API key, API secret and Sendcloud Partner id (optional)

var client = new SendCloudApi("apikey", "apisecret", "partnerid")

Get all parcels

Returns an array of Parcel objects

var parcels = await client.Parcels.Get();

Get a single parcel

Returns a Parcel object

var parcel = await client.Parcels.Get(2342);

Create a new parcel

var parcel = new CreateParcel
{
	Name = "John Smith",
	CompanyName = "ACME",
	Address = "Wellingtonstreet 25",
	City = "Wellington",
	PostalCode = "3423 DD",
	Country = "NL",
	RequestLabel = true,
	ShippingMethod = 1, // Shipping method, get possibilities from client.ShippingMethods.Get()
	OrderNumber = "ORDER2014-52321",
};
var response = await client.Parcels.Create(parcel);

Exceptions

Actions to the API may cause an Exception to be thrown in case something went wrong

try
{
	var response = await client.Parcels.Create(parcel);
}
catch (SendCloudException e)
{
	throw new Exception(e.Message);
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%