Commit 1528d2ae authored by GROSS-AMBLARD David's avatar GROSS-AMBLARD David
Browse files

suppresses unnecessary wirk files

parent 6bfc0c31
<?php
// TODO The taskline from creation step is required
// TODO Make a simple wirk with URL selector, identification
// Setup
$userApi = "headwork_wirk.io";
$passwordApi = "Y2h/Nq8p5VZF29kHXfEhuzl6c4a5FqkElw==";
$idApp = 853;
$idQuality = 1386;
$title = "Mon projet de categorisation";
//$image = "https://static.lpnt.fr/images/2019/09/25/19403277lpw-19403339-article-chat-etude-felin-jpg_6528763_660x281.jpg";
$image = "https://www.rd.com/wp-content/uploads/2020/03/GettyImages-1060486568.jpg?resize=1536,1536";
// Create AppProject
$bodyAppProject = new \stdClass();
$bodyAppProject->IdApp = $idApp;
$bodyAppProject->Title = $title;
$bodyAppProject->IdQuality = $idQuality;
$bodyAppProject->UrlNotification = "";
/*
echo "<b>Create AppProject:</b><br>";
$answerAppProject = CallAPI("POST", "https://api.wirk.io/v1_0/AppProject", $userApi, $passwordApi, json_encode($bodyAppProject));
echo "Call: ".json_encode($bodyAppProject)."<br>";
echo "Reponse: ".$answerAppProject."<br><br>";
$jsonAppProject = json_decode($answerAppProject);
$IdAppProject = $jsonAppProject->{'IdAppProject'};
// Create request
$bodyTaskLine = new \stdClass();
$bodyTaskLine->IdAppProject = $IdAppProject;
$bodyTaskLine->Inputs[] = $image;
echo "<b>Create TaskLine:</b><br>";
$answerTaskLine = CallAPI("POST", "https://api.wirk.io/v1_0/TaskLine", $userApi, $passwordApi, json_encode($bodyTaskLine));
echo "Call: ".json_encode($bodyTaskLine)."<br>";
echo "Reponse: ".$answerTaskLine."<br><br>";
*/
$jsonTaskLine = json_decode($answerTaskLine);
$IdTaskLine = $jsonTaskLine->{'IdTaskLine'};
// Get answer
echo "<b>Get TaskLine:</b><br>";
$answerTaskLineAnswer = CallAPI("GET", "https://api.wirk.io/v1_0/TaskLine/".$IdTaskLine, $userApi, $passwordApi);
echo "Reponse: ".$answerTaskLineAnswer."<br><br>";
function CallAPI($method, $url, $username, $password, $data = false)
{
$curl = curl_init();
switch ($method)
{
case "POST":
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
case "PUT":
curl_setopt($curl, CURLOPT_PUT, 1);
break;
default:
if ($data)
$url = sprintf("%s?%s", $url, http_build_query($data));
}
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, $username.":".$password);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
return $result;
}
?>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment