Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
wilbert_sison2
Active Participant
1,446
This is for those times when a single instance of an API call needs to be tested. Sometimes, API testing tools are not available or extensions to browsers are not permitted in the environment. In some instances, this neat little code below can help in a pinch. It can be executed in the console of Chrome or Edge Developer Tools which is  generally available.
fetch('https://myapiurl.com/post', {
method: 'POST',
body: JSON.stringify({
examplefield1: 'zzz',
examplefield2: 'yyy',
}),
headers: {
'Content-type': 'application/json; charset=UTF-8'
}
})
.then(res => res.json())
.then(console.log)

 

credit to the good people in Stack Overflow : Making HTTP Requests using Chrome Developer tools - Stack Overflow

 

 
Labels in this area