Hello all,
I have been struggling for days to get this thing working. I am familiar with simpler apis in n8n (already set up a similar flow for mdblist api) but not with the ones that need to request a token, access token. Dont know how to set these up within n8n. I want to add items and remove items. does anyone know how to set this up in n8n or have set up already this or similar so I can get started? Any help is much appreciated. Ready json files to work with would be awesome.
HINT: adding .md at the end of each url, gives you the raw file with more info if it helps.
Thanks,
Vasilis
TMDB v4 uses two different bearer tokens here. Your API Read Access Token authenticates the one-time setup calls. The user access token returned after browser approval authenticates the list writes. Using the app token for the final list call is the easy part to mix up.
Create a Header Auth credential for setup with header name Authorization and value Bearer <your TMDB API Read Access Token>. The first HTTP Request node is POST https://api.themoviedb.org/4/auth/request_token. Send JSON such as {"redirect_to":"https://www.themoviedb.org/"}. Its response contains request_token.
Within 15 minutes, while logged in to TMDB, open https://www.themoviedb.org/auth/access?request_token=<request_token> and approve it. That browser approval is a required human step; the request token itself cannot write to a list.
After approval, use a second HTTP Request node with the same setup credential: POST https://api.themoviedb.org/4/auth/access_token. Send {"request_token":"<the approved request_token>"} as JSON. Save the returned access_token in a second Header Auth credential with header name Authorization and value Bearer <the returned user access token>.
For add, use that user credential with POST https://api.themoviedb.org/4/list/<list_id>/items. For remove, use the same URL and credential with method DELETE. Both take the same JSON shape: {"items":[{"media_type":"movie","media_id":550}]}. Change movie to tv where needed and keep media_id numeric.
Test with one known item first. Check results[0].success, not only the HTTP 200 or top-level success, because TMDB returns a result per item. Once that passes, map your incoming media_type and media_id values into the items array. Do not put either bearer token into a workflow JSON you plan to share.
1 Like