دعم الموقع

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 أرسل رسالتك
(السهم الايمن) الصفحة التالية
(السهم الايسر) الصفحة السابقة

الاعدادات

هل تريد تقييم او اضافة هذا العنصر للقائمة؟

تسجيل الدخول