Rapid, Practical, and Innovative API Your lightweight toolkit for motivation, health tracking, geolocation, email messaging, and URL shortening..
RPI API is designed for developers and wellness enthusiasts alike. Whether you need a daily dose of inspiration, want to calculate your BMI, track your health logs, send emails on the fly, or create short URLs, RPI API has you covered.
All endpoints are available at:
https://rpi-api-production.up.railway.app/
-
Description: Fetch a random motivational quote.
-
Example:
curl https://rpi-api-production.up.railway.app/quote
-
Response:
{ "quote": "The strongest people are not those who show strength in front of us but those who win battles we know nothing about. - Unknown", "note": "These are carefully selected, less common motivational quotes" }}
-
Description: Add a new motivational quote.
-
Request Body (JSON):
{ "quote": "Your new inspirational quote here." }} -
Example:
curl -X POST -H "Content-Type: application/json" -d '{"quote": "Your new inspirational quote here."}' https://rpi-api-production.up.railway.app/quote
-
Response:
{ "status": "success", "quoteId": 11 }}
-
Description: Calculate BMI based on weight, height, age, gender, and unit system.
-
Parameters:
w: Weight (required)h: Height (required)u: Unit system (mfor metric,ifor imperial) (optional, default:m)g: Gender (mfor male,ffor female) (optional)a: Age (required)
-
Example:
curl "https://rpi-api-production.up.railway.app/bmi?w=75&h=180&u=m&g=m&a=30amp;g=m&a=30" -
Response:
{ "parameters": { "weight": 75, "height": 180, "units": "metric (kg/cm)", "gender": "male", "age": 30 }, "bmi": "23.1", "note": "BMI is a general indicator. Consult a healthcare professional for proper assessment." }}
-
Description: Retrieve geolocation information for a given IP address.
-
Parameters:
ip: IP address (optional, defaults to the requester’s IP)
-
Example:
curl "https://rpi-api-production.up.railway.app/geolocation?ip=8.8.8.8" -
Response:
{ "ip": "8.8.8.8", "country": "US", "region": "CA", "city": "Mountain View", "coordinates": { "latitude": 37.386, "longitude": -122.0838 } } }
-
Description: Log daily health data for a user.
-
Parameters (as query parameters):
n: Username (required)p: Password (required)log: Health log entry (required)
-
Example:
curl -X POST "https://rpi-api-production.up.railway.app/loghealth?n=john&p=1234&log=Felt%20great%20today%20today" -
Response:
{ "status": "success", "message": "Health log added successfully", "totalLogs": 1 }}
-
Description: Retrieve health logs for a user.
-
Parameters (as query parameters):
n: Username (required)p: Password (required)
-
Example:
curl "https://rpi-api-production.up.railway.app/getlog?n=john&p=12341234" -
Response:
{ "status": "success", "logs": [ { "timestamp": "2023-10-05T12:34:56.789Z", "log": "Felt great today" } ], "totalLogs": 1 }}
-
Description: Send an email using user-supplied credentials. This endpoint sends an email without requiring any environment variables..
-
Route Parameters:
senderEmail: The sender’s email address.appPass: The sender’s app-specific password.recipientEmail: The recipient’s email address.message: The text message to be sent.
-
Example:
curl -X POST "https://rpi-api-production.up.railway.app/email/[email protected]/appSpecificPass/[email protected]/Hello%20from%20RPI%20API" -
Response:
{ "status": "success", "info": { /* nodemailer info response */ } }}
-
Description: Create a shortened URL for a given original URL.
-
Request Body (JSON):
{ "url": "https://example.com" }} -
Example:
curl -X POST -H "Content-Type: application/json" -d '{"url": "https://example.com"}' https://rpi-api-production.up.railway.app/shorten
-
Response:
{ "original_url": "https://example.com", "short_url": "https://rpi-api-production.up.railway.app/u/abcd1234", "short_code": "abcd1234" }}
-
Description: Redirect to the original URL based on the provided short code.
-
Route Parameter:
shortCode: The unique code corresponding to the shortened URL.
-
Example:
curl "https://rpi-api-production.up.railway.app/u/abcd1234" -
Behavior: This endpoint will redirect your browser to the original URL and increment its click count.
-
Description: Retrieve statistics for a shortened URL.
-
Route Parameter:
shortCode: The unique code corresponding to the shortened URL.
-
Example:
curl "https://rpi-api-production.up.railway.app/stats/abcd1234" -
Response:
{ "original_url": "https://example.com", "short_code": "abcd1234", "created_at": "2023-10-05T12:34:56.789Z", "clicks": 5 }}
- Health Logging: Health logs are stored in an SQLite database. User credentials should be handled securely.
- BMI Calculation: The BMI value provided is a general indicator; for a comprehensive health assessment, please consult a professional.
- Geolocation: The accuracy of the geolocation information is dependent on the underlying geoip service.
- Email Sending: Ensure you provide valid email credentials. This endpoint uses nodemailer to send emails.
- URL Shortener: Each shortened URL is unique, and the API tracks the number of clicks for each.