How Do I Write A Simple REST Client in PHP For Fisheye/Crucible REST API

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

This tutorial teaches you how to interact with Fisheye/Crucible's REST interface from a PHP program. We will be writing the REST Client in PHP using the HTTPFUL Client Library. In this tutorial we will be making a GET Request to the Fisheye/Crucible's REST API to retrieve the server configuration (/rest-service-fecru/server-v1). The tutorial are as follows:-

  1. Download the HTTPFUL Client Library and place it in the folder where you would be working on.

  2. Create an index.php file and copy the code below in your working folder:

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 <?php /* * @author Aafrin * @date 22th September 2014 */ //include the HTTPFUL library class include('httpful.phar'); //Make a GET request with BASIC Authentication to retrieve the server configuration $response = \Httpful\Request::get('http://localhost:8060/rest-service-fecru/server-v1') ->authenticateWith('admin', '1234') ->send(); //Display the response echo $response; ?>
  3. Execute the index.php either from CLI or from browser by executing the php -S localhost:8000 to initiate the PHP built-in web server from the folder you are working on. The execution of the script above will make GET Request to retrieve the server configuration from the Fisheye/Crucible REST API.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.