Search code examples
javascriptnode.jsrestprotractorsuperagent

Calling Delete rest API by posting some JSON data in protractor tests


I have Delete API which will delete already registered email Ids before running my registration script.

Can someone please help me with a way to call it?

I have tried super-agent node module as below. But it didn't work

sa.delete('https://***')
    .send({"insured":"[email protected]"})
    .set('Content-Type', 'application/json')
    .end((err,res)=>{});;

Solution

  • I'm able to achieve this using restler node module executing as below:

    restler.del('<url>';,{data:{"insured":emailId}}).on('complete', function (result) { 
    if (result instanceof Error) { 
    defered.reject(result.message) 
    } 
    else { 
    defered.fulfill(result); 
    } 
    });
    

    Regards, Naresh Surya