When i send POST request form POSTMAN and get correct response
This is Form-Data Body request of Postman POST.
ENDPOINT : https://cholas.in/wp-json/digits/v1/send_otp
When i send POST request from POSTMAN and get Wrong response
JSON Body request
Content-Type : multipart/form-data;
Content-Type : multipart/form-data; header with json body :
Angular and IONIC code when i send post request
const formData = new FormData();
let httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'multipart/form-data; charset=UTF-8'
})
};
formData.append('countrycode',this.formSMS.countrycode);
formData.append('mobileNo',this.formSMS.mobileNo);
formData.append('type',this.formSMS.type);
formData.append('whatsapp',this.formSMS.whatsapp);
// rest data to the form.
//Object.keys(restObj).forEach(key => {
// formData.append(key, restObj[key]);
//});
console.log(formData);
// Send it.
return this.http.post(Url, formData, httpOptions)
.toPromise()
.catch((e) => {
console.log(e);
// handle me
});
But i get Wrong Response that i don’t want.
NB: OTP Providers Documentation NOTE: The request should be sent as POST Parameters in Body
What will be the right wey in IONIC/ANGULAR/POSTMAN(JSON Type) to getting right Resonse that i getting as POSTMAN first Screenshot ?