I am using Node.js and I need to send a POST request containing specific data to an external server. I am doing the same thing with GET, but this is a lot easier since I don't have to include the additional data. So, my working GET request looks like:
var options = {
hostname: 'internetofthings.ibmcloud.com',
port: 443,
path: '/api/devices',
method: 'GET',
auth: username + ':' + password
};
https.request(options, function(response) {
...
});
So I was wondering how to do the same thing with POST request, including data such as:
type: deviceType,
id: deviceId,
metadata: {
address: {
number: deviceNumber,
street: deviceStreet
}
}
Could anyone tell me how to include this data to the options above? Thanks in advance!