$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://optimiza-cortes-api.p.rapidapi.com/linearoptimizer/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
"Configs" => [
"bar_length" => 6000,
"saw_width" => 2,
"end_cut" => 0,
"variability" => 0,
"losses" => 0,
"iterations" => 5000,
"include_zero_cuts" => null,
"data_type" => "json"
],
"Cuts" => [
[
"Cut A",
10,
100
],
[
"Cut B",
15,
2000
],
[
"Cut C",
5,
350
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-rapidapi-host: optimiza-cortes-api.p.rapidapi.com",
"x-rapidapi-key: "COMPLETE WITH YOUR API KEY"
],
]);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://optimiza-cortes-api.p.rapidapi.com/linearoptimizer/"
payload = {
"Configs": {
"bar_length": 6000,
"saw_width": 2,
"end_cut": 0,
"variability": 0,
"losses": 0,
"iterations": 5000,
"include_zero_cuts": False,
"data_type": "json"
},
"Cuts": [["Cut A", 10, 100], ["Cut B", 15, 2000], ["Cut C", 5, 350]]
}
headers = {
"x-rapidapi-key": "COMPLETE WITH YOUR API KEY",
"x-rapidapi-host": "optimiza-cortes-api.p.rapidapi.com",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const settings = {
async: true,
crossDomain: true,
url: 'https://optimiza-cortes-api.p.rapidapi.com/linearoptimizer/',
method: 'POST',
headers: {
'x-rapidapi-key': 'COMPLETE WITH YOUR KEY',
'x-rapidapi-host': 'optimiza-cortes-api.p.rapidapi.com',
'Content-Type': 'application/json'
},
processData: false,
data: '{"Configs":{"bar_length":6000,"saw_width":2,"end_cut":0,"variability":0,"losses":0,"iterations":5000,"include_zero_cuts":false,"data_type":"json"},"Cuts":[["Cut A",10,100],["Cut B",15,2000],["Cut C",5,350]]}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"status": "success",
"configs": {
"Bar Length": 6000,
"Calculated Bar Length": 6000,
"Iterations": 5000,
"Cut Losses": 0,
"Bar Variability": 0,
"Saw Blade Width": 2,
"End Cuts for Each Side": 0,
"Include Zero Cuts": false,
"Data Type": "json"
},
"results": {
"Qty of Requested Cuts": 30,
"Qty of Optimized Cuts": 30,
"Qty of Bars Needed": 8,
"Total (Nominal) Length to be Cut": 32750,
"Total (Real) Length to be Cut": 32810,
"Total Cutting Losses": 60,
"Total Leftover": 15190
},
"bars": [
{
"Bar Number": 1,
"Total Length Used": 5978,
"Bar Left Over": 22,
"Cuts": [
{
"Nominal Length": 100,
"Name": "Cut A",
"Quantity": 9
},
{
"Nominal Length": 350,
"Name": "Cut C",
"Quantity": 3
},
{
"Nominal Length": 2000,
"Name": "Cut B",
"Quantity": 2
}
]
},
{
"Bar Number": 2,
"Total Length Used": 4810,
"Bar Left Over": 1190,
"Cuts": [
{
"Nominal Length": 100,
"Name": "Cut A",
"Quantity": 1
},
{
"Nominal Length": 350,
"Name": "Cut C",
"Quantity": 2
},
{
"Nominal Length": 2000,
"Name": "Cut B",
"Quantity": 2
}
]
},
{
"Bar Number": 3,
"Total Length Used": 4004,
"Bar Left Over": 1996,
"Cuts": [
{
"Nominal Length": 2000,
"Name": "Cut B",
"Quantity": 2
}
]
},
{
"Bar Number": 4,
"Total Length Used": 4004,
"Bar Left Over": 1996,
"Cuts": [
{
"Nominal Length": 2000,
"Name": "Cut B",
"Quantity": 2
}
]
},
{
"Bar Number": 5,
"Total Length Used": 4004,
"Bar Left Over": 1996,
"Cuts": [
{
"Nominal Length": 2000,
"Name": "Cut B",
"Quantity": 2
}
]
},
{
"Bar Number": 6,
"Total Length Used": 4004,
"Bar Left Over": 1996,
"Cuts": [
{
"Nominal Length": 2000,
"Name": "Cut B",
"Quantity": 2
}
]
},
{
"Bar Number": 7,
"Total Length Used": 4004,
"Bar Left Over": 1996,
"Cuts": [
{
"Nominal Length": 2000,
"Name": "Cut B",
"Quantity": 2
}
]
},
{
"Bar Number": 8,
"Total Length Used": 2002,
"Bar Left Over": 3998,
"Cuts": [
{
"Nominal Length": 2000,
"Name": "Cut B",
"Quantity": 1
}
]
}
]
}
"# CONFIGURATIONS"
"Configuration Parameter",Value
"Bar Length",4000
"Calculated Bar Length",4000
Iterations,5000
"Cut Losses",0
"Bar Variability",0
"Saw Blade Width",0
"End Cuts for Each Side",0
"Include Zero Cuts",
"Data Type",csv
"# RESULTS"
"Result Parameter",Value
"Qty of Requested Cuts",85
"Qty of Optimized Cuts",85
"Qty of Bars Needed",2
"Total (Nominal) Length to be Cut",7200
"Total (Real) Length to be Cut",7200
"Total Cutting Losses",0
"Total Leftover",800
"# BARS"
"Row Number","Bar Number","Total Length Used","Bar Left Over","Nominal Length",Name,Quantity
0,1,4000,0,35,"Part 2",20
1,1,4000,0,100,"Part 1",33
2,2,3200,800,100,"Part 1",32