Code Snippets – Health Fitness API¶
Welcome to the Code Snippets section! 🚀
Here, you’ll find practical examples to quickly integrate Health Fitness API into your projects using your preferred programming language.
These examples demonstrate:
- How to authenticate with your API key
- Making GET and POST requests
- Parsing real-time JSON responses
- Handling multi-language output
- Using endpoints across categories: Body Composition, Metabolism, Fitness, Risk Assessment, and more
Available Languages¶
- Python – Simple and efficient requests for RESTful API endpoints
- PHP – cURL-based examples for server-side integration
- JavaScript – Browser and frontend-ready fetch examples
- NodeJs – Backend integration using NodeJs HTTP clients
- Swift / iOS – URLSession-based examples for iOS apps
- Kotlin / Android – OkHttp and Retrofit examples for Android apps
- Flutter / Dart – HttpClient and Dio usage for cross-platform apps
- React Native / Expo – Fetch and Axios examples for mobile apps
- C# / .NET – HttpClient and RestSharp examples for .NET apps
- Go / Golang – net/http and third-party client examples
- Ruby / Rails – Net::HTTP and HTTParty integration examples
- Bash / Shell – curl-based command-line API requests
Getting Started Quickly¶
- Obtain your API key from the HefitAPI Dashboard
- Choose your preferred language from the list above
- Copy the example code
- Replace
YOUR_API_KEYwith your actual key - Run the snippet to see real-time JSON results
Example Workflow¶
# GET request example (cURL)
curl -X GET "https://api.hefitapi.com/api/v1/bmi?height=178&weight=82&units=metric&lang=en" \
-H "X-API-Key: YOUR_API_KEY"
# POST request example (cURL)
curl -X POST "https://api.hefitapi.com/api/v1/bmi/post?lang=en" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"height":178,"weight":82,"units":"metric"}'
Info
These snippets are for demonstration purposes only. Making a live request to any endpoint will return richer, real-time JSON responses including risk signals, action plans, and enterprise metadata.
Next Steps¶
Head to your preferred language to start coding:
- Python Examples
- PHP Examples
- JavaScript Examples
- NodeJs Examples
- Swift / iOS Examples
- Kotlin / Android Examples
- Flutter / Dart Examples
- React Native / Expo Examples
- C# / .NET Examples
- Go / Golang Examples
- Ruby / Rails Examples
- Bash / Shell Examples
Start integrating Health Fitness API into your apps today and unlock the full potential of health, fitness, and nutrition analytics!
Health Fitness API Powering modern digital health infrastructure