Now that I can see that there aren’t any obvious errors in your actual code, it’s easier to focus on what the actual issue is.
You appear to be using the incorrect content() function. The httr::content() function is the correct one to use and it looks like you are using it, but the error says otherwise. The only other mainstream package I know which has a content() function is NLP, so I am guessing that sometime after loading the httr package you called library("NLP") probably to do some natural language processing on your response object.
Anyway, when you loaded NLP you would have gotten a message stating,
Attaching package: 'NLP'
The following object is masked from 'package:httr':
since both packages have a content() function, whichever one was loaded most recently will be found in your search path and be used by R.
You can do one of,
Call httr::content() explicitly with the proper namespace.
Restart your R session and load NLPbeforehttr so httr::content() masks NLP::content() instead of the other way around.
I would just wrap your code inside a function call so it is easily reusable, then explicitly use the namespace for all httr functions so it can’t ever be an issue again.