tableService.deleteEntity(tableName, item, function (error, result, response) { if (!error) { context.res.status(204).send(); } else { context.res.status(500).json({error : error}); } });
tableSvc.retrieveEntity(AZURE_TABLE, userId, userName, function entityQueried(error, entity) { if (!error) { authenticated = true; userEntity = entity; session.send('I have verified your id, how can I help you? Type a) for Holidays, b) for Sick Leave.'); } else { session.send('Could not find: ' + userName + ', please make sure you use proper casing :)'); } });
tableService.queryEntities(tableName, query, null, function (error, result, response) { if(!error){ context.res.status(200).json(response.body.value); } else { context.res.status(500).json({error : error}); } });
// create the table if it doesn't exist already. tableService.createTableIfNotExists('Repositories', error => { if (error) { console.error(error) return } // creates a batch of operation to be executed var batch = new storage.TableBatch() for (var i = 0; i < input.length; i++) { var repository = input[i] // Creates an operation to add the repository to Table Storage batch.insertOrReplaceEntity({ PartitionKey: { _: 'Default' }, RowKey: { _: repository.id.toString() }, OpenedIssues: { _: repository.openedIssues }, RepositoryName: { _: repository.name } }) } // execute the batch of operations tableService.executeBatch('Repositories', batch, error => { if (error) { console.error(error) } }) })
// return item with RowKey 'id' tableService.retrieveEntity(tableName, 'Partition', id, function (error, result, response) { if (!error) { context.res.status(200).json(response.body); } else { context.res.status(500).json({error : error}); } });
// Depending on how you want this to behave you can also use tableService.mergeEntity tableService.replaceEntity(tableName, item, function (error, result, response) { if (!error) { context.res.status(202).json(result); } else { context.res.status(500).json({ error: error }); } });
// Use { echoContent: true } if you want to return the created item including the Timestamp & etag tableService.insertEntity(tableName, item, { echoContent: true }, function (error, result, response) { if (!error) { context.res.status(201).json(response); } else { context.res.status(500).json({ error: error }); } });