CallApi.Library 1.0.0

dotnet add package CallApi.Library --version 1.0.0
NuGet\Install-Package CallApi.Library -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CallApi.Library" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CallApi.Library --version 1.0.0
#r "nuget: CallApi.Library, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CallApi.Library as a Cake Addin
#addin nuget:?package=CallApi.Library&version=1.0.0

// Install CallApi.Library as a Cake Tool
#tool nuget:?package=CallApi.Library&version=1.0.0

#Call Api Library

Api used to call api or web services in the easy way in 1 line. You can call using: POST, GET, PUT and DELETE

  • Framework: .NET 6
  • NuGet
  • Language C#

Example in code in simple GET:

//instanciate
var main = new CallApi.Library.Main();

//Execute Call
var result = await main.ExecuteCall(
    basedUrl: "https://mauriciojunior.net", 
    methodUrl: "/api/user", 
    requestMethod: CallApi.Library.Util.CallType.GET, 
    headers: null, 
    body: null, 
    securityToken: null, 
    headerSecurityTokenName: null);

//Get Status
Console.WriteLine(result.StatusCode);

Example using headers and body (custom class).

//using headers
var headers = new List<CallApi.Library.Util.KeyValuePair> {
    new  CallApi.Library.Util.KeyValuePair{
        Key = "xxxx",
        Value = "1.9"
    },
    new CallApi.Library.Util.KeyValuePair
    {
        Key = "xxxxa",
        Value = "as23"
    }
};

//Model class
var user = new UserModel
{
    Id = 1,
    Name = "Mauricio Junior"
};

//Call the api
var resultWithBody = await main.ExecuteCall<UserModel>(
    basedUrl: "https://mauriciojunior.net",
    methodUrl: "/api/user",
    requestMethod: CallApi.Library.Util.CallType.POST,
    headers: headers,
    body: user,
    securityToken: null,
    headerSecurityTokenName: null);

//result with custom class
Console.WriteLine(resultWithBody.Name);
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 205 4/21/2022

Call your API in the easy and fast way. You can you to call your web service or web api using cople lines. Technology .NET