I have a curl request to an api that requires a -u parameter to set an username login and a -d to send the data of the post.
This is a template :
$ curl -i -X POST "https://onfleet.com/api/v2/workers" \
-u "c64f80ba83d7cfce8ae74f51e263ce93:" \
-d '{"name":"Marco Emery","image":"http://cdn3.addy.co/images/marco.png","phone":"415-342-0112","teams":["0pgyktD5f3RpV3gfGZn9HPIt"],"vehicle":{"type":"CAR","description":"Tesla Model 3","licensePlate":"CA 2LOV733","color":"purple"}}'
How can i translate both the -u and the -d to a node js request formatted this way ?
var options = {
host: 'www.google.com',
port: 80,
path: '/upload',
method: 'POST'
};
Or, is it possible to have a url that i could give to my web browser that would take those options into account ?
Authorization: Basic c64f80ba83d7cfce8ae74f51e263ce93: