🚚 Mandaê API .NET client wrapper
The (unofficial) Mandaê API client for .NET Framework projects.
Para a versão em português, por favor siga me.
This is an unofficial client for the Mandaê API V2
Build status | Last commit | Tests | Coverage | Code Smells | LoC |
---|---|---|---|---|---|
Download the latest zip file from the Release page.
Package | Version | Downloads |
---|---|---|
GuiStracini.Mandae |
This client supports the following operations/features of the API:
Initializes a new instance of MandaeClient class.
Example:
//Request your API token to ti@mandae.com.br
//Each environment has its own API token!
var apiToken = "my API token";
//Call the constructor with the API token and the API environment (SANDBOX | PRODUCTION).
//var client = new MandaeClient(apiToken); //<= Environment.SANDBOX is the default environment.
var client = new MandaeClient(apiToken, Environment.PRODUCTION);
Get the rates (Rápido & Econômico) values and delivery time for a specified postal code and package dimensions.
Example:
//The MandaeClient
var client = new MandaeClient("my API token");
//The RatesModel
var delivery = new RatesModel {
PostalCode = "22041080",
...
}
var rates = client.GetRates(delivery);
var fast = rates.ShippingServices.Single(s => s.Name == "Rápido");
var economic = rates.ShippingServices.Single(s => s.Name == "Econômico");
var option = ShippingService.ECONOMICO;
if(fast.Price < economic.Price)
option = ShippingService.RAPIDO;
//The OrderModel (order collect request model)
var order = new OrderModel { ... };
order.Items = new [] {
new NewItem
{
....
ShippingService = option
}
};
var order = client.RegisterOrderCollectRequest(order);
Schedule a collect request (pickup in a distribution center/origin location).
Inform which type of Vehicle, when, which rate (Rapido | Economico) and the order items (a.k.a packages or clients orders). |
Each package means an order/volume, that can have one or more items (SKUs).
Example:
//The MandaeClient
var client = new MandaeClient("my API token");
//The OrderModel (order collect request model)
var order = new OrderModel { ... };
order.Items = new [] {
new NewItem
{
....
ShippingService = option
}
};
//Makes the request
var order = client.RegisterOrderCollectRequest(order);
**
//order.Id is the id for further use (maybe cancel the request ?)
Example:
//The MandaeClient
var client = new MandaeClient("my API token");
//The tracking identifier (Generated by the Mandae or sent by the order collection request
var trackingId = "MyCompany-00001";
var tracking = client.GetTracking(tracking);
//tracking.CarrierName;
//tracking.CarrierCode;
//tracking.Events;
For the V1 you’ll need to use the e-mail/password combination of the Mandaê panel to log in V1 API.
Example:
//The MandaeClient
var client = new MandaeClient("V2 API token");
client.ConfigureV1Authentication("myEmail@example.com", "password");
var trackingCode = "XYZ000001";//The tracking code of some order
var result = client.Search(SearchMethod.TRACKING_CODE, trackingCode);
if(result.Total == 1)
Console.WriteLine(result.Orders.Single().SituationDescription);
Warning
The API V1 is not officially public, so there is no warranty that it will still be working