Skip to content
This repository has been archived by the owner on Jan 20, 2020. It is now read-only.

Javascript client to connect to the TVDB API v2. Generated using Swagger Codegen.

Notifications You must be signed in to change notification settings

potherca-abandoned/tvdb-javascript-client-sdk

Repository files navigation

the_tvdb_api_v2

TheTvdbApiV2 - JavaScript client for the_tvdb_api_v2 API v2 targets v1 functionality with a few minor additions. The API is accessible via https://api.thetvdb.com and provides the following REST endpoints in JSON format.

How to use this API documentation

You may browse the API routes without authentication, but if you wish to send requests to the API and see response data, then you must authenticate. 1. Obtain a JWT token by POSTing to the /login route in the Authentication section with your API key and credentials. 1. Paste the JWT token from the response into the "JWT Token" field at the top of the page and click the 'Add Token' button. You will now be able to use the remaining routes to send requests to the API and get a response.

Language Selection

Language selection is done via the Accept-Language header. At the moment, you may only pass one language abbreviation in the header at a time. Valid language abbreviations can be found at the /languages route..

Authentication

Authentication to use the API is similar to the How-to section above. Users must POST to the /login route with their API key and credentials in the following format in order to obtain a JWT token. {\"apikey\":\"APIKEY\",\"username\":\"USERNAME\",\"userkey\":\"USERKEY\"} Note that the username and key are ONLY required for the /user routes. The user's key is labled Account Identifier in the account section of the main site. The token is then used in all subsequent requests by providing it in the Authorization header. The header will look like: Authorization: Bearer <yourJWTtoken>. Currently, the token expires after 24 hours. You can GET the /refresh_token route to extend that expiration date.

Versioning

You may request a different version of the API by including an Accept header in your request with the following format: Accept:application/vnd.thetvdb.v$VERSION. This documentation automatically uses the version seen at the top and bottom of the page. This SDK is automatically generated by the Swagger Codegen project:

  • API version: 2.1.2
  • Package version: 2.1.2
  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install the_tvdb_api_v2 --save

git

If the library is hosted at a git repository, e.g. https://github.com/YOUR_USERNAME/the_tvdb_api_v2 then install it via:

    npm install YOUR_USERNAME/the_tvdb_api_v2 --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Getting Started

Please follow the installation instruction and execute the following JS code:

var TheTvdbApiV2 = require('the_tvdb_api_v2');

var api = new TheTvdbApiV2.AuthenticationApi()

var authenticationString = new TheTvdbApiV2.AuthenticationString(); // {AuthenticationString} JSON string containing your authentication details.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.loginPost(authenticationString, callback);

Documentation for API Endpoints

All URIs are relative to https://api.thetvdb.com/

Class Method HTTP request Description
TheTvdbApiV2.AuthenticationApi loginPost POST /login
TheTvdbApiV2.AuthenticationApi refreshTokenGet GET /refresh_token
TheTvdbApiV2.EpisodesApi episodesIdGet GET /episodes/{id}
TheTvdbApiV2.LanguagesApi languagesGet GET /languages
TheTvdbApiV2.LanguagesApi languagesIdGet GET /languages/{id}
TheTvdbApiV2.SearchApi searchSeriesGet GET /search/series
TheTvdbApiV2.SearchApi searchSeriesParamsGet GET /search/series/params
TheTvdbApiV2.SeriesApi seriesIdActorsGet GET /series/{id}/actors
TheTvdbApiV2.SeriesApi seriesIdEpisodesGet GET /series/{id}/episodes
TheTvdbApiV2.SeriesApi seriesIdEpisodesQueryGet GET /series/{id}/episodes/query
TheTvdbApiV2.SeriesApi seriesIdEpisodesQueryParamsGet GET /series/{id}/episodes/query/params
TheTvdbApiV2.SeriesApi seriesIdEpisodesSummaryGet GET /series/{id}/episodes/summary
TheTvdbApiV2.SeriesApi seriesIdFilterGet GET /series/{id}/filter
TheTvdbApiV2.SeriesApi seriesIdFilterParamsGet GET /series/{id}/filter/params
TheTvdbApiV2.SeriesApi seriesIdGet GET /series/{id}
TheTvdbApiV2.SeriesApi seriesIdHead HEAD /series/{id}
TheTvdbApiV2.SeriesApi seriesIdImagesGet GET /series/{id}/images
TheTvdbApiV2.SeriesApi seriesIdImagesQueryGet GET /series/{id}/images/query
TheTvdbApiV2.SeriesApi seriesIdImagesQueryParamsGet GET /series/{id}/images/query/params
TheTvdbApiV2.UpdatesApi updatedQueryGet GET /updated/query
TheTvdbApiV2.UpdatesApi updatedQueryParamsGet GET /updated/query/params
TheTvdbApiV2.UsersApi userFavoritesGet GET /user/favorites
TheTvdbApiV2.UsersApi userFavoritesIdDelete DELETE /user/favorites/{id}
TheTvdbApiV2.UsersApi userFavoritesIdPut PUT /user/favorites/{id}
TheTvdbApiV2.UsersApi userGet GET /user
TheTvdbApiV2.UsersApi userRatingsGet GET /user/ratings
TheTvdbApiV2.UsersApi userRatingsItemTypeItemIdItemRatingPut PUT /user/ratings/{itemType}/{itemId}/{itemRating}
TheTvdbApiV2.UsersApi userRatingsQueryGet GET /user/ratings/query
TheTvdbApiV2.UsersApi userRatingsQueryParamsGet GET /user/ratings/query/params

Documentation for Models

Documentation for Authorization

jwtToken

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

About

Javascript client to connect to the TVDB API v2. Generated using Swagger Codegen.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published