Badges
As the name suggests, this part of the documentation will show you how to access the users badges programmatically.
The Badges model
The badges model contains all the information about the badges the user has obtained, such as the image, its description (in both English and Arabic), all achievement times and other information like when can it be achieved next.
List all Badges
This endpoint allows you to retrieve a list of all the available badges along with information about achievement times if the user has obtained the badge before.
Request Headers
- Pass the Authorization header with the Bearer scheme and the user's access token.
Response attributes
- Name
I- Type
- integer
- Description
ID of the user badge (
0if the user never obtained the badge).
- Name
all_achievement_times- Type
- array
- Description
List of all the times the user has obtained the badge. Empty array if the user never obtained the badge. Each element is a string in the format YYYY-MM-DD HH:MM:SS.
- Name
badge_count- Type
- integer
- Description
Number of times the user has obtained the badge.
- Name
badge_description_a- Type
- array
- Description
Description of the badge in Arabic.
- Name
badge_description_e- Type
- array
- Description
Description of the badge in English.
- Name
badge_icon- Type
- string
- Description
URL of the badge icon.
- Name
badge_id- Type
- integer
- Description
ID of the badge.
- Name
badge_name_a- Type
- string
- Description
Name of the badge in Arabic.
- Name
badge_name_e- Type
- string
- Description
Name of the badge in English.
- Name
last_achievement_time- Type
- string
- Description
Last time the user obtained the badge. String in the format YYYY-MM-DD HH:MM:SS
- Name
next_obtainable- Type
- string
- Description
Next time the user can obtain the badge. String in the format YYYY-MM-DD
Request
curl --request GET \
--url https://api.karaz.app/v2/Users/BadgesList \
--header 'Authorization: Bearer {token}'
Response
{
"data": [
{
"I": 0,
"all_achievement_times": [],
"badge_count": 0,
"badge_description_a": [
" حصلت على شارة المشي",
"للحصول عليها مرة أخرى حقق (10000) خطوة يوميا حتى 07-05-2023"
],
"badge_description_e": [
"You earned this award for your first Walking Streak ",
"You need (10000) steps to earn this award again on 07-05-2023"
],
"badge_icon": "/media/images/badge_Icon_Kn_nWYFClm/steps_badge.png",
"badge_id": 1,
"badge_name_a": "شارة المشي",
"badge_name_e": "Walking Streak",
"last_achievement_time": "",
"next_obtainable": "2023-05-07"
},
// ...
{
"I": 36,
"all_achievement_times": [
"2023-03-17 00:00:00"
"2023-03-24 00:00:00"
],
"badge_count": 1,
"badge_description_a": [
"شارة حصرية بشهر رمضان ٢٠٢٣ "
],
"badge_description_e": [
"Exclusive Ramadan Badge 2023"
],
"badge_icon": "/media/images/badge_Icon_3GtVLLZu68/ramadan.png",
"badge_id": 8,
"badge_name_a": "رمضان ٢٠٢٣",
"badge_name_e": "Ramadan 2023",
"last_achievement_time": "2023-03-24 00:00:00",
"next_obtainable": "2023-05-05"
}
],
"status": "success"
}
List obtained Badges
This endpoint allows you to retrieve a list of all the badges user has obtained.
Request Headers
- Pass the Authorization header with the Bearer scheme and the user's access token.
Response attributes
- Name
I- Type
- integer
- Description
ID of the user badge.
- Name
all_achievement_times- Type
- array
- Description
List of all the times the user has obtained the badge. Each element is a string in the format YYYY-MM-DD HH:MM:SS.
- Name
badge_count- Type
- integer
- Description
Number of times the user has obtained the badge.
- Name
badge_description_a- Type
- array
- Description
Description of the badge in Arabic.
- Name
badge_description_e- Type
- array
- Description
Description of the badge in English.
- Name
badge_icon- Type
- string
- Description
URL of the badge icon.
- Name
badge_id- Type
- integer
- Description
ID of the badge.
- Name
badge_name_a- Type
- string
- Description
Name of the badge in Arabic.
- Name
badge_name_e- Type
- string
- Description
Name of the badge in English.
- Name
last_achievement_time- Type
- string
- Description
Last time the user obtained the badge. String in the format YYYY-MM-DD HH:MM:SS.
- Name
next_obtainable- Type
- string
- Description
Next time the user can obtain the badge. String in the format YYYY-MM-DD.
Request
curl --request GET \
--url https://api.karaz.app/v2/Users/Badges \
--header 'Authorization: Bearer {token}'
Response
{
"data": [
{
"I": 36,
"all_achievement_times": [
"2023-03-24 00:00:00"
],
"badge_count": 1,
"badge_description_a": [
"شارة حصرية بشهر رمضان ٢٠٢٣ "
],
"badge_description_e": [
"Exclusive Ramadan Badge 2023"
],
"badge_icon": "/media/images/badge_Icon_3GtVLLZu68/ramadan.png",
"badge_id": 8,
"badge_name_a": "رمضان ٢٠٢٣",
"badge_name_e": "Ramadan 2023",
"last_achievement_time": "2023-03-24 00:00:00",
"next_obtainable": "2023-05-05"
}
],
"status": "success"
}
