Поддержка The Movie Database

Hi there, I have an issue with my API Key. If I search a "top rated" with basicFetch(/trending/all/week?language=pt-BR&api_key${API_KEY}) but, receive "items: {status_code: 7, status_message: "Invalid API key: You must be granted a valid key.", success: false" someone can help me?

10 ответов (на странице 1 из 1)

Jump to last post

same problem

@Kaimzr said:

Hi there, I have an issue with my API Key. If I search a "top rated" with basicFetch(/trending/all/week?language=pt-BR&api_key${API_KEY})

Assuming you aren't putting an = in your API_KEY var (which seems unlikely), you're missing the HTML delimiter:

/trending/all/week?language=pt-BR&api_key=${API_KEY}

Would be what you're looking for.

Travis, Thanks for your reply, however the persistent error. and yes, i have a const with my api_key.

What’s is the full request that isn’t working?

Follow my code;

const API_KEY = '77e9fa013xxxxxxxxxxxxxx';
const API_BASE = 'https://api.themoviedb.org/3';

const basicFetch = async (endpoint) => {
    const req = await fetch(`${API_BASE}${endpoint}`);
    const json = await req.json();
    return json;
}

export default {
getHomeList: async () => {
    return [
        {
        slug: 'originals',
        title: 'Originais do Netflix',
        items:await basicFetch(`/discover/tv?with_network=213&language=pt-BRapi_key=${API_KEY}`)

},
   {
        slug: 'trending',
        title: 'recomendados para Você',
        items: await basicFetch(`/trending/all/week?language=pt-BR&api_key=${API_KEY}`)
   },
   {
    slug: 'toprated',
    title: 'em alta',
    items: await basicFetch(`/movie/top_rated?language=pt-BR&api_key=${API_KEY}`)
   }, 
   {
    slug: 'action',
    title: 'Ação',
    items: await basicFetch(`/discover/movi?with_genres=28&language=pt-BR&api_key=${API_KEY}`)
   }, 
   {
    slug: 'comedy',
    title: 'comedia',
    items: await basicFetch (`/discover/movi?with_genres=35&language=pt-BR&api_key=${API_KEY}`)
   }, 
   {
    slug: 'horror',
    title: 'terror',
    items: await basicFetch (`/discover/movi?with_genres=27&language=pt-BR&api_key=${API_KEY}`)
   }, 
   {
    slug: 'romance',
    title: 'romance',
    items: await basicFetch (`/discover/movi?with_genres=10749&language=pt-BR&api_key=${API_KEY}`)
   }, 
   {
    slug: 'documentary',
    title: 'documentarios',
    items: await basicFetch (`/discover/movi?with_genres=99&language=pt-BR&api_key=${API_KEY}`)
   }, 
];
}
}

all requests return me, error 401 and 404, and say my api key is invalid.

@Kaimzr said:

Follow my code;

all requests return me, error 401 and 404, and say my api key is invalid.

I believe there are some characters missing from your Requests.
Always put your API Key after the " ? "
Try building your API Request with this other sequence:

title: 'Originais do Netflix',
https://api.themoviedb.org/3/discover/tv?with_network=213&language=pt-BRapi_key=${API_KEY}`)
https://api.themoviedb.org/3/discover/tv?api_key=THE_KEY&language=pt-BR&with_networks=213
You forgot the & character before with_network=

title: 'recomendados para Você',
https://api.themoviedb.org/3/trending/all/week?language=pt-BR&api_key=${API_KEY}`)
https://api.themoviedb.org/3/trending/all/week?api_key=THE_KEY
In trending it is not possible to specify the language (pt-BR).

title: 'em alta',
https://api.themoviedb.org/3/movie/top_rated?language=pt-BR&api_key=${API_KEY}`)
https://api.themoviedb.org/3/movie/top_rated?api_key=THE_KEY&language=pt-BR
You forgot the & character before language=

title: 'terror',
https://api.themoviedb.org/3/discover/movi?with_genres=27&language=pt-BR&api_key=${API_KEY}`)
https://api.themoviedb.org/3/discover/movie?api_key=THE_KEY&language=pt-BR&with_genres=27
In this case you wrote movi, that is, movie without the " e " character at the end.

There are probably some other minor errors. :-)

@ticao2 said:

@Kaimzr said:

Follow my code;

all requests return me, error 401 and 404, and say my api key is invalid.

I believe there are some characters missing from your Requests.
Always put your API Key after the " ? "
Try building your API Request with this other sequence:

title: 'Originais do Netflix',
https://api.themoviedb.org/3/discover/tv?with_network=213&language=pt-BRapi_key=${API_KEY}`)
https://api.themoviedb.org/3/discover/tv?api_key=THE_KEY&language=pt-BR&with_networks=213
You forgot the & character before with_network=

title: 'recomendados para Você',
https://api.themoviedb.org/3/trending/all/week?language=pt-BR&api_key=${API_KEY}`)
https://api.themoviedb.org/3/trending/all/week?api_key=THE_KEY
In trending it is not possible to specify the language (pt-BR).

title: 'em alta',
https://api.themoviedb.org/3/movie/top_rated?language=pt-BR&api_key=${API_KEY}`)
https://api.themoviedb.org/3/movie/top_rated?api_key=THE_KEY&language=pt-BR
You forgot the & character before language=

title: 'terror',
https://api.themoviedb.org/3/discover/movi?with_genres=27&language=pt-BR&api_key=${API_KEY}`)
https://api.themoviedb.org/3/discover/movie?api_key=THE_KEY&language=pt-BR&with_genres=27
In this case you wrote movi, that is, movie without the " e " character at the end.

There are probably some other minor errors. :-)

tnx man

@Kaimzr said:

A curiosity of mine, I speak pt-BR.
You are the 4 user who speaks pt-BR that comes here in the last 10 days with the same problem.
Are you taking any code programming course that uses API?
Is it a school or online?
Can you say the name of the course, where it is, etc...?

@bukqueiroz said:

tnx man

A curiosity of mine, I speak pt-BR.
You are the 4 user who speaks pt-BR that comes here in the last 10 days with the same problem.
Are you taking any code programming course that uses API?
Is it a school or online?
Can you say the name of the course, where it is, etc...?

Не можете найти фильм или сериал? Войдите на сайт, чтобы добавить его.

Глобальные

s фокусироваться на панели поиска
p открыть меню профиля
esc закрыть открытое окно
? открыть окно сочетаний клавиш

На страницах медиа

b назад (или выше, если применимо)
e перейти на страницу правки

На страницах сезонов

(стрелка вправо) перейти к следующему сезону
(стрелка влево) перейти к предыдущему сезону

На страницах эпизодов

(стрелка вправо) перейти к следующему эпизоду
(стрелка влево) перейти к предыдущему эпизоду

На всех страницах изображений

a открыть окно добавления изображения

На всех страницах правки

t открыть переключатель переводов
ctrl+ s отправить форму

На страницах обсуждения

n создать новое обсуждение
w сменить статус отслеживания
p публичное/приватное
c закрыть/открыть
a открыть страницу действий
r ответить в обсуждении
l перейти к последнему ответу
ctrl+ enter отправить своё сообщение
(стрелка вправо) следующая страница
(стрелка влево) предыдущая страница

Параметры

Хотите поставить оценку или добавить в список?

Войти