diff --git a/app/Http/Controllers/ApiHelpController.php b/app/Http/Controllers/ApiHelpController.php index f566ad42b..aaefb83fa 100644 --- a/app/Http/Controllers/ApiHelpController.php +++ b/app/Http/Controllers/ApiHelpController.php @@ -2,7 +2,9 @@ namespace App\Http\Controllers; +use App\Models\Category; use Illuminate\Http\Request; +use Illuminate\View\View; class ApiHelpController extends BasePageController { @@ -14,32 +16,34 @@ class ApiHelpController extends BasePageController /** * @throws \Exception */ - public function index(): void + public function index(): View { $this->setPreferences(); - $title = 'Api Help'; - $meta_title = 'Api Help Topics'; - $meta_keywords = 'view,nzb,api,details,help,json,rss,atom'; - $meta_description = 'View description of the site Nzb Api.'; + $this->setAdminPrefs(); - $content = $this->smarty->fetch('apidesc.tpl'); - $this->smarty->assign(compact('content', 'title', 'meta_title', 'meta_keywords', 'meta_description')); - $this->pagerender(); + $this->viewData['title'] = 'Api Help'; + $this->viewData['meta_title'] = 'Api Help Topics'; + $this->viewData['meta_keywords'] = 'view,nzb,api,details,help,json,rss,atom'; + $this->viewData['meta_description'] = 'View description of the site Nzb Api.'; + $this->viewData['catClass'] = Category::class; + + return view('apidesc', $this->viewData); } /** * @throws \Exception */ - public function apiv2(): void + public function apiv2(): View { $this->setPreferences(); - $title = 'Api V2 Help'; - $meta_title = 'Api V2 Help Topics'; - $meta_keywords = 'view,nzb,api,details,help,json,rss,atom'; - $meta_description = 'View description of the site Nzb version 2 Api.'; + $this->setAdminPrefs(); - $content = $this->smarty->fetch('apiv2desc.tpl'); - $this->smarty->assign(compact('content', 'title', 'meta_title', 'meta_keywords', 'meta_description')); - $this->pagerender(); + $this->viewData['title'] = 'Api V2 Help'; + $this->viewData['meta_title'] = 'Api V2 Help Topics'; + $this->viewData['meta_keywords'] = 'view,nzb,api,details,help,json,rss,atom'; + $this->viewData['meta_description'] = 'View description of the site Nzb version 2 Api.'; + $this->viewData['catClass'] = Category::class; + + return view('apiv2desc', $this->viewData); } } diff --git a/resources/views/apidesc.blade.php b/resources/views/apidesc.blade.php new file mode 100644 index 000000000..e6987e7ad --- /dev/null +++ b/resources/views/apidesc.blade.php @@ -0,0 +1,210 @@ +@extends('layouts.main') +@section('content') +
+ Here lives the documentation for the API for accessing NZB and index data. API functions can be called by either + logged in users, or by providing an API key. +
+ @if($loggedin ?? false) +Use the parameter ?t= to specify the function being called.
| Function | +Description | +Example | +
|---|---|---|
| Capabilities | +
+ Reports the capabilities of the server. Includes information about the server name,
+ available search categories and version number of the newznab protocol being used.
+
+ No credentials required
+
+ |
+
+
+
+ ?t=caps
+
+ |
+
| Search | +
+ Returns a list of NZBs matching a query. You can filter by site category by including
+ a comma separated list of categories.
+
+ OPTIONS
+
+
+
+ extended=1 - Return extended information in results
+ |
+
+
+ @if($loggedin ?? false)
+
+
+
+ ?t=search&q=linux
+
+
+
+ ?t=search&cat={{ $catClass::GAME_ROOT }},{{ $catClass::MOVIE_ROOT }}
+
+ @endif
+ |
+
| TV Search | +
+ Returns a list of NZBs matching a query, category, or TV ID. Filter by season, episode, or various database IDs.
+
+ ID OPTIONS
+
+
+
+ rid=25056 - TVRage+ tvdbid=153021 - TVDB+ traktid=1393 - Trakt+ tvmazeid=73 - TVMaze+ imdbid=1520211 - IMDB+ tmdbid=1402 - TMDB
+ |
+
+ @if($loggedin ?? false)
+
+
+ ?t=tvsearch&q=law and order&season=7&ep=12
+
+ @endif
+ |
+
| Movies | +
+ Returns a list of NZBs matching a query, an IMDB ID and optionally a category.
+
+ OPTIONS
+
+
+
+ extended=1 - Return extended information in results
+ |
+
+ @if($loggedin ?? false)
+
+
+ ?t=movie&imdbid=1418646
+
+ @endif
+ |
+
| Details | +Returns detailed information about an NZB. | +
+ @if($loggedin ?? false)
+
+
+ ?t=details&id=9ca52909ba9b9e5e6758d815fef4ecda
+
+ @endif
+ |
+
| Info | ++ Returns NFO contents for an NZB. Retrieve the NFO as file by specifying o=file in the request URI. + | +
+ @if($loggedin ?? false)
+
+
+ ?t=info&id=9ca52909ba9b9e5e6758d815fef4ecda
+
+ @endif
+ |
+
| Get | +Downloads the NZB file associated with an ID. | +
+ @if($loggedin ?? false)
+
+
+ ?t=get&id=9ca52909ba9b9e5e6758d815fef4ecda
+
+ @endif
+ |
+
Select your preferred output format (not applicable to functions which return an NZB/NFO file).
+Returns the data in an XML document.
+?t=search&q=linux&o=xml
+ Returns the data in a JSON object.
+?t=search&q=linux&o=json
+ + Here lives the documentation for the API v2 for accessing NZB and index data. API functions can be called by providing an API token. +
+ + @if($loggedin ?? false) +| Function | +Description | +Example | +
|---|---|---|
| Capabilities | +
+ Reports the capabilities of the server. Includes information about the server name,
+ available search categories and version number of the nntmux being used.
+
+ No credentials required
+
+ |
+
+
+
+ capabilities
+
+ |
+
| Search | ++ Returns a list of NZBs matching a query. You can filter by site category by including + a comma separated list of categories. + | +
+
+ @if($loggedin ?? false)
+
+
+
+ search?id=linux
+
+
+
+ search?cat={{ $catClass::GAME_ROOT }},{{ $catClass::MOVIE_ROOT }}
+
+ @endif
+ |
+
| TV Search | +
+ Returns a list of NZBs matching a query, category, TVRageID, season or episode.
+
+ ID OPTIONS
+
+
+
+ rid=25056 - TVRage+ tvdbid=153021 - TVDB+ traktid=1393 - Trakt+ tvmazeid=73 - TVMaze+ imdbid=1520211 - IMDB+ tmdbid=1402 - TMDB
+ |
+
+
+ @if($loggedin ?? false)
+
+
+
+ tv?id=law and order&season=7&ep=12
+
+
+
+ tv?rid=2204&cat={{ $catClass::GAME_ROOT }},{{ $catClass::MOVIE_ROOT }}
+
+ @endif
+ |
+
| Movies | +
+ Returns a list of NZBs matching a query, an ID (IMDB, TMDB, or Trakt) and optionally a category.
+
+ ID OPTIONS
+
+
+
+ imdbid=1418646 - IMDB+ tmdbid=43418 - TMDB+ traktid=29200 - Trakt
+ |
+
+
+ @if($loggedin ?? false)
+
+
+
+ movies?imdbid=1418646
+
+
+
+ movies?imdbid=1418646&cat={{ $catClass::MOVIE_SD }},{{ $catClass::MOVIE_HD }}
+
+ @endif
+ |
+
| Details | +Returns detailed information about an NZB. | +
+ @if($loggedin ?? false)
+
+
+ details?id=9ca52909ba9b9e5e6758d815fef4ecda
+
+ @endif
+ |
+
| Get NZB | +Downloads the NZB file associated with an ID. | +
+ @if($loggedin ?? false)
+
+
+ getnzb?id=9ca52909ba9b9e5e6758d815fef4ecda
+
+ @endif
+ |
+
All information is returned in JSON format.
+