Skip to main content

Welcome to DonaSF API

This guide will help you make your first API calls to the DonaSF platform. You’ll learn how to authenticate and interact with the core donation management endpoints.

Prerequisites

  • .NET 10.0 or later (if running locally)
  • API base URL (e.g., http://localhost:5005)
  • A valid user account or test credentials

Installation

1

Clone the Repository

Clone the DonaSF backend repository to your local machine:
git clone <repository-url>
cd DonaSF-Back/ServiciosConsolaCentralizada
2

Configure Settings

Update appsettings.json with your configuration:
{
  "Jwt": {
    "Key": "Q1w2e3r4t5y6u7i8o9p0a1s2d3f4g5h6j7k8l90@",
    "Expires": 3600
  }
}
3

Run the Application

Start the API server:
dotnet run
The API will be available at http://localhost:5005 in development mode.

Making Your First API Call

1. Register a New Client

First, create a client account to get started:
curl -X POST http://localhost:5005/Cliente/InsCliente \
  -H "Content-Type: application/json" \
  -d '{
    "Password": "yourpassword123",
    "Nombre": "John Doe",
    "CTelefono": "+1",
    "Telefono": "5551234567",
    "CorreoElectronico": "[email protected]"
  }'

2. Authenticate and Get JWT Token

Use your credentials to obtain a JWT token:
curl -X POST http://localhost:5005/Cliente/Login \
  -H "Content-Type: application/json" \
  -d '{
    "Identificador": "[email protected]",
    "Password": "yourpassword123"
  }'
Response:
{
  "Tokens": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "Identificador": "[email protected]",
  "Expiracion": "2026-03-13T12:00:00Z",
  "IdCliente": 123,
  "Nombre": "John Doe",
  "Activo": true
}

3. Make an Authenticated Request

Now use the JWT token to query donation information:
curl -X POST "http://localhost:5005/Donacion/VerDonaciones?identificador=DON123" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN_HERE" \
  -H "Content-Type: application/json"
Response:
{
  "Resultado": true,
  "Mensaje": "Donación encontrada",
  "idmisionero": 5,
  "idtalon": 10,
  "iddonante": 25,
  "idclave": 3,
  "idestado": 1,
  "idestadoentrega": 2
}

Create a Donation

To create a new donation record:
curl -X POST http://localhost:5005/Donacion/CrearDonacion \
  -H "Authorization: Bearer YOUR_JWT_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "idmisionero": 5,
    "idtalon": 10,
    "iddonante": 25,
    "idclave": 3,
    "idestado": 1,
    "idestadoentrega": 2
  }'

Next Steps

Authentication Guide

Learn more about JWT authentication, token management, and security best practices

API Reference

Explore all available endpoints and their parameters

Architecture

Understand the system architecture

Error Handling

Understand error codes and how to handle them
Development Mode: In development, the API automatically opens Swagger UI at http://localhost:5005/swagger for interactive API exploration.

Build docs developers (and LLMs) love