Change values, add new rows, and see the changes in the API payload as well as the results.
Best options rank (v1)
The results are ordered, identifying each option and its respective percentage of preference, in decimal format.
API v1 is the base of all, it's more faster than API v2 because it does not need to calculate the contribution of each criteria.
It is the best choice for those who don't need details, if you just need to have an objective view of which options are the best, use v1.
Detailed Contribution (v2)
The contributions in the JSON represent how each attribute of an item influenced the final decision in the overall ranking. They help to understand which factors had the most weight for each item, taking into account the "max" and "min" criteria defined by the user. In other words, they show the impact of each attribute (such as price, storage, memory, etc.) on the choice of an item.
Global Contribution (v2)
The global part of the JSON indicates the total weight that each phone had in the final decision. This weight reflects the sum of the individual contributions of all the phone's attributes. In this case:
- Phone A contributed 18.81% to the decision.
- Phone B contributed 26.42%.
- Phone C contributed 25.92%.
- Phone D contributed 28.84%.
These numbers help to identify which item (phone) was most important or influential in the overall decision.
Detailed Contribution (v2)
The detailed part shows the specific weight that each attribute (price, storage, memory, camera, battery) had in the decision for each phone individually.
Example with Phone A:
- Price contributed 10.15%.
- Storage contributed 17.72%.
- Memory contributed 22.78%.
- Camera contributed 24.07%.
- Battery contributed 25.27%.
These detailed numbers explain which attributes were more or less important for each particular item, helping to understand, for example, that in Phone A, the battery and the camera had a greater influence on the result than the price.
In summary:
The overall contribution shows the total weight of each item in the final decision.
The detailed contribution shows how each specific attribute influenced the decision for each item.
AHP Decision Maker Endpoint Documentation
This endpoint allows you to send criteria and options to the API and get a best choice recommendation based on the AHP (Analytic Hierarchy Process) method.
Endpoint
URL v1: https://apibi.wead.tech/ahp/v1
URL v2: https://apibi.wead.tech/ahp/v2
Verb: POST
Authentication
The following headers must be sent for authentication:
keycode
: Your Key Code
secret
: Your Secret
Request Body
The request must include a JSON with the criteria and options to be analyzed.
{
"data": {
"criteria": {
"price US$": "min",
"storage GB": "max",
"memory GB": "max",
"camera Mpx": "max",
"battery mAh": "max"
},
"options": {
"Phone A": [9494,128,6,48,4323],
"Phone B": [4139,256,8,50,4500],
"Phone C": [4429,256,8,50,4300],
"Phone D": [1885,128,6,64,5065]
}
}
}
Examples
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://apibi.wead.tech/ahp/v2',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"data": {
"criteria": {
"price US$": "min",
"storage GB": "max",
"memory GB": "max",
"camera Mpx": "max",
"battery mAh": "max"
},
"options": {
"Phone A": [9494,128,6,48,4323],
"Phone B": [4139,256,8,50,4500],
"Phone C": [4429,256,8,50,4300],
"Phone D": [1885,128,6,64,5065]
}
}
}',
CURLOPT_HTTPHEADER => array(
'keycode:<YOUR_KEYCODE>',
'secret:<YOUR_SECRET>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
cURL (Bash)
curl --location --request POST 'https://apibi.wead.tech/ahp/v2' \
--header 'keycode:<YOUR_KEYCODE>' \
--header 'secret:<YOUR_SECRET>' \
--header 'Content-Type: application/json' \
--data-raw '{
"data": {
"criteria": {
"price US$": "min",
"storage GB": "max",
"memory GB": "max",
"camera Mpx": "max",
"battery mAh": "max"
},
"options": {
"Phone A": [9494,128,6,48,4323],
"Phone B": [4139,256,8,50,4500],
"Phone C": [4429,256,8,50,4300],
"Phone D": [1885,128,6,64,5065]
}
}
}'
Python
import requests
import json
url = "https://apibi.wead.tech/ahp/v2"
payload = json.dumps({
"data": {
"criteria": {
"price US$": "min",
"storage GB": "max",
"memory GB": "max",
"camera Mpx": "max",
"battery mAh": "max"
},
"options": {
"Phone A": [9494, 128, 6, 48, 4323],
"Phone B": [4139, 256, 8, 50, 4500],
"Phone C": [4429, 256, 8, 50, 4300],
"Phone D": [1885, 128, 6, 64, 5065]
}
}
})
headers = {
'keycode':'<YOUR_KEYCODE>',
'secret':'<YOUR_SECRET>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
API Response
The API returns a response in JSON format containing the ranking of the options according to the defined criteria.