Hello Jitesh,
In order to answer your query, instead of calling two api to insert image URL along with insertJSONDocument method. You can call insertJSONDocumentWithFile method to save image url, please find below code snippet for the same and let me know if you need any help from my side:
var storage = new App42Storage();
var dbName = "database name";
var collectionName = "collection name";
var filePath = document.getElementById("filePath");
var name = "file name";
var file = filePath.files[0];
var fileJSON = new Object();
fileJSON.name = name;
fileJSON.type = "IMAGE";
fileJSON.filePath = file; // File Path of your image which you need to upload
var result ;
storage.insertJSONDocumentWithFile(dbName, collectionName, "{\"name\":\"Himanshu\"}",fileJSON,{
success: function(object) {
result = JSON.parse(object);
console.log(result.app42.response)
},
error: function(error) {
}
});
Regards,
Himanshu Sharma