Skip to content

Commit 8f81b92

Browse files
committed
fix: use PATCH for updates, complete HL API route map, fix Content-Type on GET
1 parent d8c66e1 commit 8f81b92

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,94 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
77

88
---
99

10+
## [1.4.1] – 2026-03-16
11+
12+
### Added
13+
14+
- **`_HLAPI_ROUTE_MAP`**: Complete route map for the GLPI 11 High-Level API (`/api.php`).
15+
The HL API uses namespaced paths instead of flat itemtypes. 35 itemtypes mapped across
16+
5 namespaces: `Assistance/`, `Assets/`, `Administration/`, `Management/`, `Dropdowns/`,
17+
`Knowledgebase/` and `Project/`.
18+
- **`_hl_route(itemtype)`** helper: Resolves any GLPI itemtype to its correct HL API path.
19+
Falls back to the itemtype name as-is for unmapped types (plugins, custom assets).
20+
21+
### Changed
22+
23+
- **`GlpiOAuthClient` / `AsyncGlpiOAuthClient`** now accept `username` and `password`
24+
in the constructor. They are used automatically in `authenticate()` and token refresh,
25+
removing the need to pass credentials on every call.
26+
- **`client_credentials` grant**: Documented as unsupported for the `api` scope in GLPI 11
27+
(only works for `inventory`). The `password` grant is the recommended method for scripts.
28+
- **Update operations** now use `PATCH /{route}/{id}` instead of `PUT` — GLPI 11 HL API
29+
only accepts `GET`, `PATCH`, `DELETE` on individual resources.
30+
- **Create operations** now send the object directly as the JSON body (no `{"input": ...}`
31+
wrapper) — HL API v2 does not use the legacy input wrapper.
32+
- **Delete operations** now use `DELETE /{route}/{id}` with no request body.
33+
34+
### Fixed
35+
36+
- **`__getattr__` recursion bug** in both OAuth clients: accessing `api.ticket` triggered
37+
recursive `__getattr__` calls when `_proxies` was not yet in `__dict__`, causing the proxy
38+
to be created with a corrupted session reference. The `Authorization: Bearer` header was
39+
never sent, resulting in `ERROR_UNAUTHENTICATED` on every request after `authenticate()`.
40+
Fixed by using `object.__getattribute__` to access `_proxies` safely.
41+
- **`Content-Type: application/json` on GET requests**: GLPI 11 interprets this header as
42+
requiring a JSON body, returning `"Cuerpo JSON inválido"` on GET requests that have no
43+
body. Fixed by only including `Content-Type` when there is a JSON payload.
44+
- **Token endpoint**: Fixed `_token_url` construction when the base URL included
45+
`/api.php/v2.2` — the token endpoint is always `/api.php/token` regardless of API version.
46+
47+
---
48+
49+
## [1.4.0] – 2026-03-16
50+
51+
### Added
52+
53+
- **`_HLAPI_ROUTE_MAP`** (initial version): First namespace-aware route map for the GLPI 11
54+
High-Level API. Covered core itemtypes: `Assistance/Ticket`, `Assets/Computer`,
55+
`Administration/User`, etc.
56+
- **`_hl_route(itemtype)`** helper introduced to resolve itemtypes to their HL API paths.
57+
58+
### Changed
59+
60+
- **CRUD operations adapted for HL API v2 semantics**:
61+
- `create_item`: body sent directly without `{"input": ...}` wrapper.
62+
- `update_item`: uses `PATCH /{route}/{id}` with ID extracted from input dict.
63+
- `delete_item`: uses `DELETE /{route}/{id}` with no request body.
64+
65+
---
66+
67+
## [1.3.9] – 2026-03-16
68+
69+
### Added
70+
71+
- **`_HLAPI_ROUTE_MAP`** (preliminary): Initial route map covering `Assistance/Ticket`,
72+
`Assets/Computer`, `Administration/User`, `Management/Contract` and a subset of other
73+
common itemtypes, derived from the GLPI 11 Swagger endpoint list.
74+
75+
---
76+
77+
## [1.3.8] – 2026-03-16
78+
79+
### Fixed
80+
81+
- **`Content-Type: application/json` on GET requests**: `_auth_headers()` previously
82+
included `Content-Type` on every request. GLPI 11 interprets this header as requiring
83+
a valid JSON body, returning `"Cuerpo JSON inválido"` (400) on GET requests with no body.
84+
Fixed with a `with_content_type` flag — only sent when a JSON payload is present.
85+
86+
---
87+
88+
## [1.3.7] – 2026-03-16
89+
90+
### Fixed
91+
92+
- **Token URL construction**: `_token_url` now always resolves to `/api.php/token`
93+
regardless of what the base URL contains. Passing a URL with `/api.php/v2.2` no longer
94+
causes double-path issues on the token and API endpoints.
95+
96+
---
97+
1098
## [1.3.6] – 2026-03-16
1199

12100
### Changed

0 commit comments

Comments
 (0)