let content = JSON.parse(response.body);
My guess is that the problem is that the content array in the JSON is sometimes empty. Then when you do content, you're getting back the first element of an empty array, which is, understandably, undefined. Then you try to get .data on the undefined and that triggers the error.
Try putting the JSON to the console and inspecting it visually to see if it has all the fields you expect.
let content = JSON.parse(response.body)
Its saying response is not defined.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.