post method with xxx-formurl encoded and token headers
postUserRole(obj: any) {
const myheader = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': `Bearer ${this.token}`
})
};
let body = new HttpParams();
body = body.set("RoleId", "0");
body = body.set("RoleName", "apptest");
body = body.set("Description", "testing");
body = body.set("Status", "active");
body = body.set("RecordsCount", "0");
body = body.set("ActiveStatus", "0");
body = body.set("DuplicateRoleName", "");
body = body.set("SwitchPermission", "false");
body = body.set("MasterpermissionStatus", "true");
return this.httpClient.post<any>("https://dev.psplhyd.com/Crmangular13-API/api/1/userrolesapi", body, httpOptions).pipe(catchError(this.errorHandler))
}
https://entityframeworkcore.com/knowledge-base/59151584/how-to-execute-stored-procedure-for-multiple-parameters-using-fromsqlinterpolated-in-ef-core-3-0-
https://stackoverflow.com/questions/51605542/angular-6-http-post-request-with-x-www-form-urlencoded-data
No comments:
Post a Comment