Skip to content

Instantly share code, notes, and snippets.

@laser
Last active August 29, 2015 14:22
Show Gist options
  • Save laser/ee0b85ee94a8b3006f1c to your computer and use it in GitHub Desktop.
Save laser/ee0b85ee94a8b3006f1c to your computer and use it in GitHub Desktop.
API Search Functionality

MovieClips API, Search Functionality

Responsible for servicing mobile clients' search requests. Involves issuing HTTP request to the Search Service (for ids) and then to individual services (Video Service, Movie Service) for full objects.

Table of Contents

Autocomplete

iOS story and comps here

Autocomplete queries that work include sending some or all of the strings:

  • The African Queen
  • The Art of Animalia
  • The Apartment
  • The Birds
  • The Dark Crystal

Sample HTTP request/response (from mobile device):

curl -v http://dev-backstage.fandango.com/movieclips/mobile/videos/autocomplete?query=The+\&pageSize=5


HTTP 200 application/json

[{
  "name": "all",
  "contents": [VideoSearchResult, VideoSearchResult]
}]

Search Results

iOS story and comps here

Autocomplete queries that work include sending the full string:

  • Star Trek

Sample HTTP request/response (from mobile device):

HTTP GET http://dev-backstage.fandango.com/movieclips/mobile/videos/search?query=Star+Trek&pageSize=5


HTTP 200 application/json

[{
  "name": "Star Trek IV: ...",
  "contents": [
    VideoSearchResult, VideoSearchResult, VideoSearchResult, VideoSearchResult, VideoSearchResult,
    VideoSearchResult, VideoSearchResult, VideoSearchResult, VideoSearchResult, VideoSearchResult
  ]
}, {
  "name": "Star Trek III: \"The Search for Spock\"",
  "contents": [
    VideoSearchResult, VideoSearchResult, VideoSearchResult, VideoSearchResult, VideoSearchResult,
    VideoSearchResult, VideoSearchResult, VideoSearchResult, VideoSearchResult, VideoSearchResult
  ]
}]

Autogenerate Playlist

This autogenerate-URL will accept a videoId for any video id seen in the search or autocomplete responses.

Sample HTTP request/response (from mobile device):

HTTP GET http://dev-backstage.fandango.com/movieclips/mobile/playlists/auto/447801411744


HTTP 200 application/json

{
  "id":0,
  "title":"auto-447801411744",
  "videos": [VideoWithTagsAndMovies, VideoWithTagsAndMovies, VideoWithTagsAndMovies]
}

Example Entities

VideoSearchResult

{
  "id": "408200771913",
  "title": "13 Assassins",
  "alternateTitle": "Official Clip - Arrow Ambush",
  "originalImage": {
    "sourceUrl": "http://cdn.com/image-12345.jpg",
    "height": 640,
    "width": 480
  }
}

VideoWithTagsAndMovies

{
  "id": "447801411744",
  "guid": "VD-1491",
  "amgId": "V2667",
  "imdbId": "tt0053604",
  "title": "The Apartment",
  "description": "Shirley MacLaine, Jack Lemmon, Ray Walston, Fred MacMurray, Jack Kruschen, Edie Adams in The Apartment",
  "alternateTitle": null,
  "youtubeTitle": null,
  "type": "Trailer",
  "rank": null,
  "studio": "Twentieth Century Fox Home Entertainment",
  "studioId": null,
  "duration": 138.389,
  "mature": false,
  "definition": "0",
  "provider": "Video Detective",
  "dateCreated": "2015-05-19T20:29:45.000Z",
  "dateUpdated": "2015-05-19T21:06:56.000Z",
  "dateTerminated": null,
  "keywords": null,
  "contentUrl": "http://link.theplatform.com/s/NGweTC/media/kkxmI9nqSIcw",
  "suppressAds": false,
  "publicId": "kkxmI9nqSIcw",
  "approved": false,
  "catchphrases": [],
  "movies": [Movie, Movie, Movie],
  "tags": [Tag, Tag, Tag],
  "legacyId": "2667480481",
  "dateAvailable": null,
  "dateExpired": null,
  "originalImage": null,
  "filmstrip": "http://statcdn.fandango.com/MPX/image/NBCU_Fandango/49/723/000614-1.fs",
  "overlayImage": null,
  "people": ["P267", "P39495", "P44255", "P44291", "P74480", "P99306"]
}

Tag

{
  "id": 3105,
  "slug": "movie",
  "tag": "Movie",
  "categoryId": 101,
  "categoryName": "Video Detective",
  "categorySlug": "video-detective",
  "dateCreated": "2015-03-19T01:03:23.400Z",
  "dateUpdated": "2015-03-19T01:03:23.400Z",
  "dateTerminated": null  
}

Movie

{
  "id": 14273,
  "title": "Star Trek III: The Search for Spock",
  "releaseDate": "1984-06-01T00:00:00.000Z",
  "contentRating": "PG",
  "runtime": 105,
  "synopsis": "Adm. James T. Kirk (William Shatner) has defeated his archenemy but at great cost. His friend Spock has apparently been killed, the USS Enterprise is being scrapped, and starship physician Dr. Leonard \"Bones\" McCoy (DeForest Kelley) has taken ill. McCoy's odd behavior is evidence he's harboring Spock's katra, or animating spirit, and Kirk seeks to take the Enterprise back to the Genesis Planet and find his friend. Rebuffed, Kirk takes dramatic action that results in war with deadly Klingons.",
  "shortSynopsis": "Kirk battles Klingons in his quest for his old friend.",
  "mediumSynopsis": "Kirk (William Shatner) and his crew try to reunite Spock's mind and body.",
  "longSynopsis": "Kirk (William Shatner) and the crew steal the old Enterprise and head for Vulcan to reunite the mind and body of Mr. Spock.",
  "image": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment