cancel
Showing results for 
Search instead for 
Did you mean: 

How to call an API in SAP CDC Javascript

0 Kudos

Hi,

We have a requirement to make an account.resetpassword API on reset password UI builder page. So can some one help how to make an API call in Javascript it would be helpful if get a sample code.

Thanks,

olehi941
Active Participant
0 Kudos

Hi Maheswari K,
Could you add more clarity? It could better understand your requirement.

You need to call accounts.resetPassword JS API here(screenshot attached)?
And what exactly you need to do base on your requirement?

0 Kudos

Yes, I have password reset error page where it will show an error if password reset token expires. so now I need to modify that page like previous link expired and new password reset link will send in that case I need to trigger password reset API on the error page. so the process is when ever user gets error page automatically new reset password email should trigger

Accepted Solutions (0)

Answers (1)

Answers (1)

yogananda
Product and Topic Expert
Product and Topic Expert

maheswariiii

You can make an API call using the JavaScript Fetch API. Here is an example of how to call a resetpassword API using the Fetch API:

// Make a POST request to the resetpassword API
fetch('https://example.com/resetpassword', {
method: 'POST',
body: JSON.stringify({
username: 'exampleUsername'
}),
headers: {
'Content-type': 'application/json; charset=UTF-8'
}
})
.then(response => response.json())
.then(json => {
// This is where you can handle the response from the API
console.log(json);
});
0 Kudos

I tried this one and its not working

yogananda
Product and Topic Expert
Product and Topic Expert
maheswariiii

do you have API endpoint ? or sample endpoint ?