Issue
I have a REST API as below which is using the HTTP DELETE
method. I have to pass this body in that HTTP DELETE
method in Angular. Please help. I cannot change the structure of this body
{
"transactions": [
{
"eventId": "21012200237172",
"productCode": "LC",
"id": "LC20110000090023"
}
]
}
Solution
you can pass body in httpdelete with options
let apiUrl = 'yourUrl';
let transactions = [{
"eventId": "21012200237172",
"productCode": "LC",
"id": "LC20110000090023"
}];
const options = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
}),
body: {
transactions: transactions
},
};
this.httpClient
.delete(apiUrl, options)
.subscribe((s) => {
console.log(s);
},err => {
console.log(err);
});
Answered By - Syed Mohammad Fahim Abrar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.