Skip to content

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

  1. Obtain your API key from the HefitAPI Dashboard
  2. Choose your preferred language from the list above
  3. Copy the example code
  4. Replace YOUR_API_KEY with your actual key
  5. 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:

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