We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all. I have been searching extensively over the last few days in a bid to find a way of access an online JSON API using an API key i have. So for a limited number of requests you do not need the API key, great for testing to start... i have managed to access the JSON using the LoadStrings method with no problem and now i have also managed to access it get data using the HTTP Requests For Processing Plugin (the updated one by Koogs: https://github.com/acdean/HTTP-Requests-for-Processing
My issue is now that i cant figure out how to add the header properly so that my request is accepted using the API Key... I have attached a screen shot of what i am trying so far, could a kind sole point me in the right direction?
Info on the API that i am trying to access is here: https://api.football-data.org/docs/v1/index.html
P.S. The code will work at present as you get a set amount of free calls before having to use the API Key. I have locked it out previously though and cannot get the API key to be accepted in order to get more calls, hence my plea for help :-)
Thanks in advance for any help.
Answers
Edit post, highlight code, press ctrl-o to format.
Posting API keys is a terrible idea.
Thanks. Key is just a freebie so thought id keep it in to help, have taken it out now though :)
you are adding the headers (lines 16, 17) AFTER sending the request (line 11). you probably need to do it before.
Thanks. I had it that way before but it wasnt working, forgot to put it back to the logical way :(
I was worried i wasnt adding the header in the correct way but it seems to be right from examples i have seen. I will keep on playing around with it.
this seems to be enough, even without the api key. i get a list of fixtures, all of spurs' away games
what are you expecting?
Thanks Koogs.
I wanted to get the API key working as a personal test for me, to help understand and learn how it all works.
As with most things i do its always the simplest thing that was wrong... X-Application should have simply been X-Auth-Token.... feeling a little silly now but glad i solved it. Now on to running the code a set number of times per hour :)
Thanks for your responses, helped me keep digging :)