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
- Host: GitHub
- URL: https://github.com/henriqb/hbehr.fipeapi
- Owner: henriqb
- License: mit
- Created: 2017-02-05T14:23:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-07T22:02:27.000Z (over 9 years ago)
- Last Synced: 2025-03-09T23:34:34.136Z (over 1 year ago)
- Topics: api, asp-net, c-sharp, fipe, rest-api, tabela-fipe
- Language: C#
- Size: 40 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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; }
}
```