An open API service indexing awesome lists of open source software.

https://github.com/henriqb/hbehr.fipeapi

C# .NET Blibioteca para acessar a API pública da tabela FIPE para veículos
https://github.com/henriqb/hbehr.fipeapi

api asp-net c-sharp fipe rest-api tabela-fipe

Last synced: about 1 year ago
JSON representation

C# .NET Blibioteca para acessar a API pública da tabela FIPE para veículos

Awesome Lists containing this project

README

          

# hbehr.FipeAPI
C# .NET Blibioteca para acessar a API pública da tabela FIPE para veículos.

To understand how FIPE Public API works, read on http://fipeapi.appspot.com/

## Instalation
Get it on nuget: https://www.nuget.org/packages/hbehr.FipeAPI

PM> Install-Package hbehr.FipeAPI

## How to use

### Initialize
```C#
FipeApi api = new FipeCarrosApi(); // For Cars
FipeApi api = new FipeCaminhoesApi(); // For Trucks
FipeApi api = new FipeMotosApi(); // For Motorcycles
```

### Load Marcas
```C#
IEnumerable marcas = await api.GetMarcasAsync(); // Assync
IEnumerable marcas = api.GetMarcas(); // Sync

public struct Marcas
{
public string key { get; set; }
public string id { get; set; }
public string fipe_name { get; set; }
public string name { get; set; }
}
```

### Load Veículos (Modelos/Versões)
```C#
string marcaId = marcas.First().id;
IEnumerable marcas = await api.GetVeiculosAsync(marcaId); // Assync
IEnumerable marcas = api.GetVeiculos(marcaId); // Sync

public struct Veiculos
{
public string fipe_marca { get; set; }
public string name { get; set; }
public string marca { get; set; }
public string key { get; set; }
public string id { get; set; }
public string fipe_name { get; set; }
}
```

### Load Ano Modelo (Ano/Modelo)
```C#
string veiculoId = veiculos.First().id;
IEnumerable anoModelos = await api.GetAnoModelosAsync(marcaId, veiculoId); // Assync
IEnumerable anoModelos = api.GetAnoModelos(marcaId, veiculoId); // Sync

public struct AnoModelo
{
public string fipe_marca { get; set; }
public string fipe_codigo { get; set; }
public string name { get; set; }
public string marca { get; set; }
public string key { get; set; }
public string veiculo { get; set; }
public string id { get; set; }
}
```

### Load Preço Corrente
```C#
string anoModeloId = anoModelos.First().id;
PrecoCorrente precoCorrente = await api.GetPrecoCorrenteAsync(marcaId, veiculoId, anoModeloId);
PrecoCorrente precoCorrente = api.GetPrecoCorrente(marcaId, veiculoId, anoModeloId);

public struct PrecoCorrente
{
public string id { get; set; }
public string ano_modelo { get; set; }
public string marca { get; set; }
public string name { get; set; }
public string veiculo { get; set; }
public string preco { get; set; }
public string combustivel { get; set; }
public string referencia { get; set; }
public string fipe_codigo { get; set; }
public string key { get; set; }
}
```