cancel
Showing results for 
Search instead for 
Did you mean: 

How to call an API in SAP CDC Javascript

0 Kudos
516

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,

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 ?