ArticPolar.Dev.FetchData 1.0.0

dotnet add package ArticPolar.Dev.FetchData --version 1.0.0                
NuGet\Install-Package ArticPolar.Dev.FetchData -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="ArticPolar.Dev.FetchData" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ArticPolar.Dev.FetchData --version 1.0.0                
#r "nuget: ArticPolar.Dev.FetchData, 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 ArticPolar.Dev.FetchData as a Cake Addin
#addin nuget:?package=ArticPolar.Dev.FetchData&version=1.0.0

// Install ArticPolar.Dev.FetchData as a Cake Tool
#tool nuget:?package=ArticPolar.Dev.FetchData&version=1.0.0                

ArticPolar.Dev.FetchData

Fetch Data from API (Or Other) Using TWO Methods: GET and POST

Example

using System;
using ArticPolar.Dev.FetchData;

namespace FetchConsoleTest
{
    internal class Program
    {
        static void Main(string[] args)
        {
            // URL da API JSONPlaceholder para testes
            string apiUrl = "https://jsonplaceholder.typicode.com/posts";

            // Conteúdo JSON para a solicitação POST (exemplo simples)
            string jsonContent = "{\"title\": \"Novo Post\", \"body\": \"Conteúdo do novo post\"}";

            FetchData apiFetcher = new FetchData();

            // Teste do método GET
            Console.WriteLine("Testando o método GET...");
            string getData = apiFetcher.Fetch(apiUrl);

            if (getData != null)
            {
                Console.WriteLine("Dados da API (GET):");
                Console.WriteLine(getData);
            }
            else
            {
                Console.WriteLine("Falha ao buscar dados da API (GET).");
            }

            // Teste do método POST
            Console.WriteLine("\nTestando o método POST...");
            string postData = apiFetcher.PostData(apiUrl, jsonContent);

            if (postData != null)
            {
                Console.WriteLine("Resposta da API (POST):");
                Console.WriteLine(postData);
            }
            else
            {
                Console.WriteLine("Falha ao fazer a solicitação POST para a API.");
            }
        }
    }
}

Requeriments

Net Framework 4.7.1

Product Compatible and additional computed target framework versions.
.NET Framework net471 is compatible.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7.1

    • No dependencies.

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 184 9/19/2023

First Version