GET Hero Relation
The API endpoint utilizes a required path parameter, hero_id, an integer from 1 to 127, to retrieve relationship data for a specific hero. The successful JSON response includes a success code and message, and the data field containing a records array. This array holds an object with the main hero's name, its hero_id, and a relation object. The relation object categorizes the hero's relationships into assist, strong, and weak based on target_hero_id arrays. These arrays hold hero IDs that represent heroes that synergize well, heroes that the main hero is strong against, and heroes that the main hero is weak against, respectively.
Endpoint
GET /api/hero-relation/<int:hero_id>/
Path Parameters
-
hero_id The ID of the hero whose relationships are to be fetched.
- Possible Values: From
1
to127
- Type: integer
- Required:
True
- Possible Values: From
Example Requests
GET /api/hero-relation/127/
This request fetches relationship data for a specific hero with the ID 127.
Example Usage
Python requests
import requests
import json
def fetch_api(api_url):
try:
response = requests.get(api_url)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f"Error: {e}")
return None
api_url = "https://mlbb-stats.ridwaanhall.com/api/hero-relation/127/"
data = fetch_api(api_url)
print(json.dumps(data, indent=4) if data else "No data fetched.")
Direct API Access
Click this to Access the API directly
Result
{
"code": 0,
"message": "OK",
"data": {
"records": [
{
"data": {
"hero": {
"data": {
"name": "Lukas"
}
},
"hero_id": 127,
"relation": {
"assist": {
"target_hero_id": [
93,
6,
41
]
},
"strong": {
"target_hero_id": [
60,
121
]
},
"weak": {
"target_hero_id": [
17,
57,
116
]
}
}
}
}
],
"total": 1
}
}