fanart.tv api v3 (1 Viewer)

ltfearme

Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    Thanks for not changing the JSON structure for movie images very much, took 1 sec to upgrade :)
     
    Last edited:

    Kode

    Portal Member
    April 26, 2011
    13
    10
    Home Country
    United Kingdom United Kingdom
    No problem, thanks for doing that, the only real change to output should be instead of:
    Code:
    {
        "The Lord of the Rings: The Fellowship of the Ring":{
            "tmdb_id":"120",
            "imdb_id":"tt0120737"
            "hdmovielogo": [
                {
                    "id": "50927",
                    "url": "[URL]http://assets.fanart.tv/fanart/movies/120/hdmovielogo/the-lord-of-the-rings-the-fellowship-of-the-ring-5232c108a0b11.png[/URL]",
                    "lang": "en",
                    "likes": "7"
                 },
    it should now be:
    Code:
    {
        "name": "The Lord of the Rings: The Fellowship of the Ring",
        "tmdb_id": "120",
        "imdb_id": "tt0120737",
        "hdmovielogo": [
            {
                "id": "50927",
                "url": "http://assets.fanart.tv/fanart/movies/120/hdmovielogo/the-lord-of-the-rings-the-fellowship-of-the-ring-5232c108a0b11.png",
                "lang": "en",
                "likes": "7"
            },
    which should make it a lot easier to use the api as there is no messing around trying to get the first item
     

    Kode

    Portal Member
    April 26, 2011
    13
    10
    Home Country
    United Kingdom United Kingdom
    A quick note, if anyone implements this the results returned from the API differ depending on what you send to it:

    v2 API - Images approved more than 2 weeks
    v3 API - Images approved more than 1 week
    v3 API + Personal API key - Images approved more than around 48 hours
    v3 API + Personal API key + VIP member - Images approved more than around 10 minutes

    Personal API keys are new, they can be created at https://fanart.tv/get-an-api-key/ but obviously they need developer support to use.

    VIP member isn't something that gets sent, it will automatically be identified from the Personal API key.

    The personal key can be sent as a query var or a header (as can the api_key)

    As a query var the url might look like https://webservice.fanart.tv/v3/mov...2&client_key=52c813aa7b8c8b3bb87f4797532a2f8c

    As a header the underscore becomes a hyphen so something like:

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://webservice.fanart.tv/v3/movies/17645');
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('api-key: 6fa22b0ef3b5f3bba6a7edaa76675ac2', 'client-key: 52c813aa7b8c8b3bb87f4797532a2f8c'));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    curl_close($ch);
    echo $result;
     

    Users who are viewing this thread

    Top Bottom