I’m relatively new to coding, and I was able to call a REST API, and record the information to the console log.
Unfortunately, where I am having trouble, is then taking that response and doing literally anything with it. Here is the code and the response below
let response = await fetch(‘https://myapiendpoint.com’,
{
method: ‘GET’,
headers: {
‘apikey’: ‘123456789’
},
})
console.log(await response.text());
The response I get is in XML it seems. A small excerpt of the response below:
<User><Id>USER ID</Id><UserName>USER NAME</UserName><FirstName>FIRST NAME</FirstName><LastName>LAST NAME</LastName><Active>true</Active><Email>EMAIL</Email></User>
I want to take the objects in this response (for example FirstName and LastName), and assign them to variables so that records can be created in later steps. I appreciate any assistance that can be given!


