API can only be used by PRO account owners.
Request URL: https://smartcut.pro/api_cut_v2.php
Request Method: GET / POST
Request parameters:
api_token: 7b055fb51658096e0968b224a1b730b0 (example)
params: -l 12000:SourceName -s 2 -b 10000:2:source-name-2 -c 1600-4-PartName1 2400-8-prtname-2 2500-4-Name 1300-5
https://smartcut.pro/api_cut_v2.php?api_token=7b055fb51658096e0968b224a1b730b0¶ms=-l%2012000:SourceName%20-s%202%20-b%2010000:2:source-name-2%20-c%201600-4-PartName1%202400-8-prtname-2%202500-4-Name%201300-5
Warning! Names must be encoded, i.e. all non-alphanumeric characters in names except -_. must be replaced with a percent sign (%) followed by two hexadecimal numbers. It is allowed, but not recommended, to use unencoded names only if they do not contain whitespace characters. Passing raw whitespace characters will throw an error when accessing the API.
1600-4-Part Name 1 2400-8-prtname 2 ->
1600-4-urlencode("Part Name 1") 2400-8-urlencode("prtname 2") ->
1600-4-Part%20Name 1 2400-8-prtname%202
$data = array(
'api_token' => '7b055fb51658096e0968b224a1b730b0',
'params' =>
'-l 12000:' . urlencode("SourceName") .
' -s 2' .
' -b 10000:2:' . urlencode("source-name-2") .
' -c 1600-4-' . urlencode("PartName1") .
' 2400-8-' . urlencode("prtname-2") .
' 2500-4-' . urlencode("Name") .
' 1300-5'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://smartcut.pro//api_cut_v2.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/x-www-form-urlencoded"
));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
If you use the GET method to access the API, then in addition to encoding the names, you must additionally encode the entire query string.
https://smartcut.pro/api_cut_v2.php?api_token=7b055fb51658096e0968b224a1b730b0¶ms=urlencode("-l 12000:urlencode("Source Name") -s 2 -b 10000:2:urlencode("source name 2") -c 1600-4-urlencode("PartName1") 2400-8-urlencode("prtname 2") 2500-4-Name 1300-5") ->
https://smartcut.pro/api_cut_v2.php?api_token=7b055fb51658096e0968b224a1b730b0¶ms=-l%2012000:Source%2520Name%20-s%202%20-b%2010000:2:source%2520name%25202%20-c%201600-4-PartName1%202400-8-prtname%25202%202500-4-Name%201300-5
those. encoding for names happens twice.
{
"status":"ok", // or "error"
"solution":{
"10000 source-name-2": [
[
1,
{
"1300": 2,
"1600 PartName1": 3,
"2500 Name": 1
}
],
[
1,
{
"1300": 2,
"2400 prtname-2": 2,
"2500 Name": 1
}
]
],
"12000 SourceName": [
[
1,
{
"2500 Name": 2,
"2400 prtname-2": 2,
"1600 PartName1": 1
}
],
[
1,
{
"2400 prtname-2": 4,
"1300": 1
}
]
]
},
"remaining_source_items":{
},
"remaining_parts":[
]
}