Vos commentaires
This has been released.
il y a 10 ans
This has been fixed
Hi Erik,
Any POST and PUT request to our API must be JSON formatted.
Here's an example of how to create a bug with PHP and the popular lib Guzzle:
Note: remember to replace the <PROJECT ID> and <OAUTH TOKEN> placeholders.
Any POST and PUT request to our API must be JSON formatted.
Here's an example of how to create a bug with PHP and the popular lib Guzzle:
Note: remember to replace the <PROJECT ID> and <OAUTH TOKEN> placeholders.
<?php
// Include Guzzle. If using Composer:
// require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Post\PostBody;
use GuzzleHttp\Stream\StreamInterface;
use GuzzleHttp\Exception\RequestException;
function send_request() {
// Create (POST https://api.leantesting.com/v1/projects/<PROJECT ID>/bugs)
$client = new Client();
$request = $client->createRequest('POST', 'https://api.leantesting.com/v1/projects/<PROJECT ID>/bugs');
$postBody = $request->getBody();
try {
$request->addHeaders([
'Authorization'=>'Bearer <OAUTH TOKEN>',
]);
$body = [
"description" => "Hello from the API :smile:",
"severity_id" => 3,
"steps" => [
"Step 1",
"Step 2",
"Step 3"
],
"project_version" => "1.0.1",
"title" => "A bug reported from the SDK",
"platform" => [
"os" => "iOs",
"os_version" => "8.1",
],
"type_id" => "1",
"reproducibility_id" => 1,
"status_id" => 1,
"expected_results" => "Should work smoothly"
];
$request->setBody(GuzzleHttp\Stream\Stream::factory(json_encode($body)));
$response = $client->send($request);
echo "Response HTTP : " . $response->getStatusCode();
}
catch (RequestException $e) {
echo "HTTP Request failed\n";
echo $e->getRequest();
if ($e->hasResponse()) {
echo $e->getResponse();
}
}
}
That is very cool
Service d'assistance aux clients par UserEcho