How to use the delete function from request

Find comprehensive JavaScript request.delete code examples handpicked from public code repositorys.

274
275
276
277
278
279
280
281
282
283

let requestObject = utilsForImport.requestForImport;
requestObject.url = utilsForImport.requestForImport.baseurl + url + 'keys/' + consumerKey;
requestObject.method = "DELETE";

request.delete(requestObject, function (err, res, body) {

    if(err){
        return console.log('Error in deleting auto-generated keys for the "' + appName + '"');
    }
fork icon2
star icon4
watch icon0

579
580
581
582
583
584
585
586
587
588
589
};


// Restarts the bot (requires deploying to Heroku – see config)
// Includes optional callback
exports.restart = (callback = () => { }) => {
    request.delete({
        "url": `https://api.heroku.com/apps/${config.appName}/dynos/web`,
        "headers": {
            "Accept": "application/vnd.heroku+json; version=3",
            "Authorization": `Bearer ${credentials.TOKEN}` // Requires Heroku OAuth token for authorization
fork icon0
star icon1
watch icon1

138
139
140
141
142
143
144
145
146
147
// make a request to the backend microservice using the request package
// the URL for the backend service should be set in configuration 
// using an environment variable. Here, the variable is passed 
// to npm start inside package.json:
//  "start": "BACKEND_URL=http://localhost:8082 node server.js",
request.delete(  // first argument: url + data + formats
    {
        url: SERVER + '/event/like',  // the microservice end point for liking an event
        body: req.body,  // content of the form
        headers: { // uploading json
fork icon0
star icon0
watch icon0