Hello everyone!
I am trying to get video information using Twitch API, but i confused with results… It’s so strange…
Dev API page says i must send this GET request:
https://api.twitch.tv/kraken/videos/<video ID>
Okay… If i using CURL in windows console with command:
curl -H "Accept: application/vnd.twitchtv.v5+json" -H "Client-ID: <ID>" -X GET "https://api.twitch.tv/kraken/videos/370746236"
It’s working fine. I get correct JSON-file.
But if i write my code in Delphi:
var
t, cmd : string;
begin
IdHTTP1.Request.CustomHeaders.Clear;
IdHTTP1.Request.CustomHeaders.Add('Accept: application/vnd.twitchtv.v5+json');
IdHTTP1.Request.CustomHeaders.Add('Client-ID: <ID>');
cmd := 'https://api.twitch.tv/kraken/videos/370746236';
t := IdHTTP1.Get(cmd);
MemoJSON.Lines.Text := t;
end;
It works, but recieves wrong JSON-file which missing some important info. E.g. all URLs to big thumbnails previews is missed, and some other fields.
What’s wrong? How to fix it?
Please help!
Then why does the Delphi program recieves the wrong file from the server? How to fix it?
Here is the file i get: https://pastebin.com/mNxkQEji. It’s incomplete. Why?
I not decoding JSON-file. I just need to receive it correctly. Decoding it is not a problem.
What you mean saying it? I need to get these picture files.
For whatever reason your Delphi HTTP calls are not sending both headers. I can’t find anything in google to help with this. I’m at a loss with it right now.