I'll leave you a brief explanation:
First of all you should instantiate the HttpClient class something like this:
use Cake\Http\Client;
$http = new Client();
Now we must know what method we are going to consume:
- GET
- POST
- PUT
- DELETE .. ETC ..
GET EXAMPLE (bring a query):
$response = $http->get('http://ejemplo.com/search', ['id' => '1001']);
In this brief example I consult an article / product by id, it can be id, name, code, etc ... it depends on how the service you are going to consume was established.
POST EXAMPLE (add / insert data):
$response = $http->post('http://ejemplo.com/articulos/add', [
'codigo' => 'art-505',
'nombre' => 'Iphone 6 16gb'
]);
In this case it is the POST method, which I send as parameters code and name to the service in response I have the result of my method. either error or satisfactory.
and so .. you should try with the desired methods and see what results it brings.
I hope it will guide you!