
wger API
Sports & FitnessWorkout manager data as exercises, muscles or equipments. Public endpoints, such as the list of exercises or the ingredients can be accessed without authentication. For user owned objects such as workouts, you need to generate an API KEY and pass it in the header, see the link on the sidebar for details. You should always use HTTPS if possible when communicating with the server.
π Documentation & Examples
Everything you need to integrate with wger API
π Quick Start Examples
// wger API API Example
const response = await fetch('https://wger.de/en/software/api', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
Exploring the Wger API with JavaScript
Are you looking for a reliable fitness API to integrate into your project? Look no further because Wger API is the one. Here is a quick guide on how to use Wger API with JavaScript.
Getting started
Firstly, you need to create an account and have an API key. Once you have an API key, you can start making requests to the API endpoint.
Making a request
To make a request to Wger API, you need to use the fetch
method which is a web API for making API requests in JavaScript.
Here is an example code in JavaScript to get all exercises in Wger API.
fetch(" https://wger.de/api/v2/exercise/")
.then((response) => response.json())
.then((data) => console.log(data));
The above code will return a response that contains all the exercises in Wger API.
Authenticating request
If you want to make a request that requires user authentication, you need to pass your API key in the request header. Here is an example code in JavaScript to authenticate a request to get all user's logs:
fetch("https://wger.de/api/v2/workoutlog/", {
headers: {
"Authorization": "Token " + api_key,
"Content-Type": "application/json"
}
})
.then((response) => response.json())
.then((data) => console.log(data));
Make sure to replace api_key
with your actual API key.
Filtering data
Wger API allows you to filter data by specific parameters. For example, if you want to get all exercises that belong to a specific category, you can add a category
parameter to the URL.
Here is an example code in JavaScript to get all exercises that belong to the category with ID 10
:
fetch("https://wger.de/api/v2/exercise/?category=10")
.then((response) => response.json())
.then((data) => console.log(data));
Conclusion
The Wger API is a powerful and easy-to-use API that is free to use. With the above examples, you can get started with using Wger API in your next project.
π 30-Day Uptime History
Daily uptime tracking showing online vs offline minutes