Fortnite Api geht nicht?

1 Antwort

Habe keinen API Key in keine Bock einen Account zu machen, aber um APIs zu testen nehme ich am liebsten Postman.

Versuche Mal Testweise eine API wofür du keinen Key brauchst. Z.b. das hier www.thecocktaildb.com/api/json/v1/1/random.php

Sollte dir einen zufälligen cocktail ausgeben, kann's du auch im Browser aufrufen weil du keinen API Key brauchst.

Das ist einfacher weil du da keinen auth Key im header brauchst.

Wenn dass nicht klappt, dann löse erstmal das Problem, den auth Header kannst du danach noch inzufügen.

PS, wir können dir besser helfen wenn du deinen Code postest. Und, Fang klein an. Fang nicht mit irgendwelchen Push Benachrichtigungen an bevor du überhaupt überprüft hast ob die API funktioniert. Du musst dir die Aufgabe sinnvoll einteilen.


CrazyChicken334 
Fragesteller
 18.09.2021, 11:17
Requests will return remaining throttle left in the headers.

oder

To use the API key you need to pass it along as a header with your requests.

Steht auf der Website der Api mit dem key..
Also wenn ich ihn im Browser aufrufe, bekomme ich zurück, dass kein Key angegeben ist. Bei "deiner" Api kann ich sie auch im Browser lesen. Wenn ich jedoch in meinem bisherigem sehr verwirrten php Code deine Url angebe, gibt er genauso, nichts aus..
Zur Not kann ich es auch gerne in Javascript machen.. hauptsache ich hab dann die Daten der Api und ich kann sie schön in meine html einbauen..

Hast du maybe nen link, wo das genau beschrieben ist?..

0
jort93  18.09.2021, 14:09
@CrazyChicken334

Zeig Mal deinen aktuellen Code. Übergibst du überhaupt einen auth Header?

1
CrazyChicken334 
Fragesteller
 18.09.2021, 17:59
@jort93

Mein Code war/ist unvollständig ich hatte jetzt mal diese Erklärung bekommen:

 —
heute um 13:45 Uhr
Do you know how HTTP(S) works?
1. You need to connect api.fortnitetracker.com on 443 port for https on 80 for http
2. There is TLS negotiation (fot HTTPS only) so encryption of transport protocol is established
3. Now you can do your request sending similar text to your server
GET /v1/store HTTP/1.1
Host: api.fortnitetracker.com
User-Agent: User agent string of my browser
accept: */*
GET is HTTP method (could be POST, HEAD, OPTIONS, PUT, DELETE and others)
Host, User-Agent, Accept are headers (you can look desctription of this headers on Mozlilla Developer Network website)
you can add your custom headers
so even if you send something like
GET /v1/store HTTP/1.1
Host: api.fortnitetracker.com
User-Agent: User agent string of my browser
accept: */*
MyCustomHeader: 123456
it should work, but as web application does not require this it will simple ignore it
but if webapllication API needs to have information about API Key in specific header it will look for this header in request you had sent
if this information like API Key, or Cookie or something else is missing, or wrong it will typically return some 4xx error where 4xx is some http error code like 403 forbidden. You can find meaning of these codes on MDN website
0