Hi, I hope this is where I should put this. I am trying to build a website that uses REST API. The site will be used to call information from FilmOn and then present it on my website but I cant get my head around REST API. I have looked on the net for basics and tuition but still cant make head nor tail of it. I have sort of worked out how to get the info from FilmOn using HTTP but I haven't got a clue of how to use the data in my own site. Any pointers please. Kind regards, David
REST is pretty simple. There are a few HTTP verbs that are used for different things. When you want to retrieve data from the API you will make a GET request. When you want to create a new record via the API you make a PUT request. When you want to updated an existing piece of data via the API you make a POST request. When you want to remove an item (if the API allows it) you make a DELETE request. Most APIs will have a wrapper around the API for several languages that makes it easier to interact with the system without handling low-level details yourself.
I had the same problem, when I started . basically to use a REST API you have to make certain requests to a server(a URL), sending some data and receiving some data back, the way a browser does. Except its your program that would talk with the api(a server). There are 2 common requests GET and POST . For your purposes you may not have to really go deep into their differences, for now. But just note which method uses which request (GET or POST) , then figure out how to send a get/post request using your language of choice , then send the request (get or post) to the correct URL , with the required parameters . So in the case of filmon first send a GET request to http://www.filmon.com/tv/api/init parse the returned data (its in json format) use json_decode to get the data into a php object. get the session_key from the php_object and store it . Now with every other request you have to send the session_key as one of the parameters hth
Thank you both for your replies. I have managed to work out what to do regarding calling? for info. I am presented with the following (just a snippet) {"group_id":"11","id":"11","title":"LIFESTYLE","name":"LIFESTYLE","group":"LIFESTYLE","original_name":"LIFESTYLE","alias":"lifestyle","description":"","weight":"9","logo_uri":"http:\/\/static.filmon.com\/couch\/groups\/11\/logo.png?v2","logo_148x148_uri":"http:\/\/static.filmon.com\/couch\/groups\/11\/big_logo.png","logos":[{"size":"56x28","url":"http:\/\/static.filmon.com\/couch\/groups\/11\/logo.png?v2"},{"size":"148x148","url":"http:\/\/static.filmon.com\/couch\/groups\/11\/big_logo.png"}],"channels":[{"id":1711,"logo":"http:\/\/static.filmon.com\/couch\/channels\/1711\/logo.png?v2","big_logo":"http:\/\/static.filmon.com\/couch\/channels\/1711\/big_logo.png","description":"Psychic Today has for the last 9 years been making psychics from all over the planet available to you in your own home!\nWhat would you like guidance on? Past, present, future? Love, career, family? Our TV & at home psychics are 1 call away. Tune in for your daily dose of spirituality.","title":"Psychic Today","group":"LIFESTYLE","group_id":11,"type":"standard","alias":"psychic-today","is_free":true,"is_free_sd_mode":true,"is_adult":false,"is_interactive":false,"is_vod":false,"is_vox":false,"has_description":true,"has_tvguide":true,"chat_keyword":"filmon_psychic_today","isFavorited":false},{"id":1714,"logo":"http:\/\/static.filmon.com\/couch\/channels\/1714\/logo.png? Could someone give me a basic PHP or preferable a HTML example of how I would display the information on my own website. Thanks again. David