From 0ddc99bc32eb37388abacb0925e2a65b6995edd5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 13 May 2026 14:26:29 +0200 Subject: [PATCH] NEW Category - API - Add type list (#38207) Co-authored-by: Laurent Destailleur --- .../categories/class/api_categories.class.php | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index b25fc415b0a..2f7ad4f5181 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -1,9 +1,10 @@ - * Copyright (C) 2024 Jose MARTINEZ + * Copyright (C) 2024 Jose Martinez * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025 MDW * Copyright (C) 2025 Charlene Benke + * Copyright (C) 2026 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -182,6 +183,26 @@ class Categories extends DolibarrApi return $obj_ret; } + /** + * List categories types + * + * Get a list of type of categories according to filters + * + * @return array Array of category types + * @url GET /types + * + * @throws RestException + */ + public function getTypes() + { + + if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) { + throw new RestException(403); + } + + return Categorie::$MAP_TYPE_TITLE_AREA; + } + /** * Create category object *