From f19a154965a46fccc59a5eb441ab7b3ca16d590e Mon Sep 17 00:00:00 2001 From: DariusIII Date: Mon, 6 Oct 2025 09:48:23 +0200 Subject: [PATCH] Fix API descriptions --- app/Http/Controllers/ApiHelpController.php | 36 ++-- resources/views/apidesc.blade.php | 210 +++++++++++++++++++++ resources/views/apiv2desc.blade.php | 208 ++++++++++++++++++++ 3 files changed, 438 insertions(+), 16 deletions(-) create mode 100644 resources/views/apidesc.blade.php create mode 100644 resources/views/apiv2desc.blade.php 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') +
+
+

{{ $title }}

+
+
+

+ 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) +
+

Your API Credentials

+
+ + +
+
+ @endif +

Available Functions

+

Use the parameter ?t= to specify the function being called.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionDescriptionExample
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 +
+
+
+ +
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 +
DetailsReturns 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 +
GetDownloads the NZB file associated with an ID. + @if($loggedin ?? false) + + + ?t=get&id=9ca52909ba9b9e5e6758d815fef4ecda + + @endif +
+
+

Output Format

+

Select your preferred output format (not applicable to functions which return an NZB/NFO file).

+
+
+
+
+
XML (default)
+

Returns the data in an XML document.

+ ?t=search&q=linux&o=xml +
+
+
+
+
+
+
JSON
+

Returns the data in a JSON object.

+ ?t=search&q=linux&o=json +
+
+
+
+
+
+ +@endsection diff --git a/resources/views/apiv2desc.blade.php b/resources/views/apiv2desc.blade.php new file mode 100644 index 000000000..d8bb1457c --- /dev/null +++ b/resources/views/apiv2desc.blade.php @@ -0,0 +1,208 @@ +@extends('layouts.main') + +@section('content') +
+
+

{{ $title }}

+
+
+

+ 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) +
+

Your API Credentials

+
+ + +
+
+ @endif + +

Available Functions

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionDescriptionExample
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. + + +
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 +
+
+
+ +
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 +
+
+
+ +
DetailsReturns detailed information about an NZB. + @if($loggedin ?? false) + + + details?id=9ca52909ba9b9e5e6758d815fef4ecda + + @endif +
Get NZBDownloads the NZB file associated with an ID. + @if($loggedin ?? false) + + + getnzb?id=9ca52909ba9b9e5e6758d815fef4ecda + + @endif +
+
+ +

Output Format

+
+
+
+ +
+
JSON Format
+

All information is returned in JSON format.

+
+
+
+
+ +
+ + Note: When using these API endpoints in your applications, always send your API token with each request. +
+
+
+ + +@endsection +