error when I tried Barcode Scanner with Database Sample App

var dbApiKey = "5d29931e2e22d70923c3bc29";
var name = request.get("name");
var code = request.get("code");
var quantity = request.get("quantity");
var result;

var search = ScriptCall.call("https://api.appery.io/rest/1/code/22b...", {"code": code});

var searchResponse = JSON.parse(search.body);

if (search.status === "200") {
// update product
result = Collection.updateObject(dbApiKey, "Products", searchResponse._id, {
"Name": name,
"Quantity": quantity
});
} else {
// save new product
result = Collection.createObject(dbApiKey, "Products", {
"Name": name,
"Code": code,
"Quantity": quantity
});
}
Apperyio.response.success(result, "application/json");


I can't run the script properly
1 person has
this problem
+1
Reply