MATLAB minimal HTTP POST request example

% Define the URL
url = 'https://httpbin.org/post';

% Data to send
data = struct('name', 'John', 'age', 30);

% Convert data to JSON format
jsonData = jsonencode(data);

% Set request options
options = weboptions('RequestMethod', 'post', ...
                    'ContentType', 'json', ...
                    'MediaType', 'application/json');

% Make the POST request
response = webwrite(url, jsonData, options);

% Display the response
disp(response)