Calling post api with file in the body

I want to call a rest API which takes an image as input. But I am not able to pass the file. We can send the URL of the image as an input to the API. Following is the body format.

{ ‘url’: ‘String URL of the Image’}

When I call the same API from the postman it works fine. But not able to understand how can we call it from the nodeJS.

If any one could help me in that.

Thanks & Best Regards,
Sagar

Use axios package to send your POST request here is an exemple :

var formData = new FormData();
var imagefile = document.querySelector('#file');
formData.append("image", imagefile.files[0]);
axios.post('URL_TO_API', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
})

HTML

<form id="uploadForm"  role="form" method="post" enctype=multipart/form-data>
    <input type="file" id="file" name="file">
    <input type=submit value=Upload>
</form>