I'm running an API POST script and I'm trying to utilize the id that is returned in the response.
This is the key piece of the script.
var postOptions = {
method: 'POST',
headers: myHeaders,
body: formdata,
redirect: 'follow'
};
let response = await remoteFetchAsync("https://xyz.com/...", postOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
I get this response. I'd like to then reference that id returned.
CONSOLE.LOG
"{"id":29644,"progress":0,"current_line":null,"status":"created","created_at":"2023-09-12T09:30:39-07:00","started_at":null,"ended_at":null,"file_url":null}"
I've tried this, but I get an undefined error.
console.log(response.result.id)