Documentation Index Fetch the complete documentation index at: https://mintlify.com/JanContrerasDev/gestor-contrasenas/llms.txt
Use this file to discover all available pages before exploring further.
Get Started in 5 Minutes
This guide will walk you through setting up the Password Manager API and making your first API request.
Clone and Install
First, clone the repository and install dependencies: git clone https://github.com/JanContrerasDev/gestor-contrasenas.git
cd gestor-contrasenas
composer install
Make sure you have PHP 8.0.2 or higher and Composer installed on your system.
Configure Environment
Copy the example environment file and configure your database: cp .env.example .env
php artisan key:generate
Edit .env and set your database credentials: DB_CONNECTION = mysql
DB_HOST = 127.0.0.1
DB_PORT = 3306
DB_DATABASE = password_manager
DB_USERNAME = your_username
DB_PASSWORD = your_password
Create Database and Run Migrations
Create the database and run migrations to set up tables: mysql -u your_username -p -e "CREATE DATABASE password_manager;"
php artisan migrate
This creates the necessary passwords table with columns for password, sistema, usuario, and status.
Start the Development Server
Launch the Laravel development server: Your API is now running at http://localhost:8000 By default, Laravel serves on port 8000. You can specify a different port with --port=8080
Make Your First API Call
Now that your API is running, let’s create your first password entry.
Create a Password
Send a POST request to create a new password:
curl -X POST http://localhost:8000/api/createPassword \
-H "Content-Type: application/json" \
-d '{
"password": "mySecurePassword123",
"sistema": "GitHub",
"usuario": "john.doe@example.com"
}'
Expected Response:
{
"message" : "SE CREÓ UNA NUEVA CONTRASEÑA" ,
"status" : 200
}
All three fields (password, sistema, usuario) are required. Missing any field will return a 400 error with validation details.
Retrieve All Passwords
Fetch all active passwords in the system:
curl http://localhost:8000/api/listPassword
Expected Response:
[
{
"id" : 1 ,
"password" : "mySecurePassword123" ,
"sistema" : "GitHub" ,
"usuario" : "john.doe@example.com" ,
"status" : 1
}
]
The listPassword endpoint only returns passwords with status = 1 (active passwords).
Get a Specific Password
Retrieve a single password by ID:
curl http://localhost:8000/api/getPassword/1
Expected Response:
{
"passwords" : {
"id" : 1 ,
"password" : "mySecurePassword123" ,
"sistema" : "GitHub" ,
"usuario" : "john.doe@example.com" ,
"status" : 1
},
"status" : 200
}
Update a Password
Modify an existing password entry:
curl -X POST http://localhost:8000/api/updatePassword/1 \
-H "Content-Type: application/json" \
-d '{
"password": "newSecurePassword456",
"sistema": "GitHub",
"usuario": "john.doe@example.com"
}'
Expected Response:
{
"password" : {
"id" : 1 ,
"password" : "newSecurePassword456" ,
"sistema" : "GitHub" ,
"usuario" : "john.doe@example.com" ,
"status" : 1
},
"message" : "contraseña actualizada" ,
"status" : 200
}
Delete a Password
Soft delete a password (sets status to 0):
curl -X POST http://localhost:8000/api/deletePassword/1
Expected Response:
{
"message" : "contraseña borrada" ,
"status" : 200
}
Deletion is a soft delete operation. The password is marked as inactive (status = 0) but remains in the database.
API Endpoints Summary
List Passwords GET /api/listPasswordReturns all active passwords
Get Password GET /api/getPassword/{id}Retrieve a specific password by ID
Create Password POST /api/createPasswordCreate a new password entry
Update Password POST /api/updatePassword/{id}Update an existing password
Delete Password POST /api/deletePassword/{id}Soft delete a password entry
Error Handling
The API returns standard HTTP status codes:
200 - Success
400 - Bad Request (validation errors)
404 - Not Found (password doesn’t exist)
500 - Internal Server Error
Common Errors
Validation Error (400)
Not Found (404)
No Passwords (404)
{
"message" : "Invalid data" ,
"errors" : {
"password" : [ "The password field is required." ],
"sistema" : [ "The sistema field is required." ],
"usuario" : [ "The usuario field is required." ]
},
"status" : 400
}
cURL
JavaScript (fetch)
Python (requests)
PHP (Guzzle)
# Create password
curl -X POST http://localhost:8000/api/createPassword \
-H "Content-Type: application/json" \
-d '{"password":"test123","sistema":"AWS","usuario":"admin"}'
const response = await fetch ( 'http://localhost:8000/api/createPassword' , {
method: 'POST' ,
headers: {
'Content-Type' : 'application/json' ,
},
body: JSON . stringify ({
password: 'test123' ,
sistema: 'AWS' ,
usuario: 'admin'
})
});
const data = await response . json ();
console . log ( data );
import requests
response = requests.post(
'http://localhost:8000/api/createPassword' ,
json = {
'password' : 'test123' ,
'sistema' : 'AWS' ,
'usuario' : 'admin'
}
)
print (response.json())
use GuzzleHttp\ Client ;
$client = new Client ();
$response = $client -> post ( 'http://localhost:8000/api/createPassword' , [
'json' => [
'password' => 'test123' ,
'sistema' => 'AWS' ,
'usuario' => 'admin'
]
]);
$data = json_decode ( $response -> getBody (), true );
print_r ( $data );
Next Steps
API Reference Detailed documentation for all endpoints
Authentication Secure your API with Laravel Sanctum