CustomAlerts API uses inconsistent parameter and response names compared to the rest of the Reporting API
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- php
- Ambito
- api, backend-api-design
Direzione di ricerca
Traccia le definizioni dei parametri e delle risposte di CustomAlerts.addAlert, CustomAlerts.editAlert e CustomAlerts.getAlerts, quindi confronta la loro denominazione con quella delle altre entità di Reporting API. Riproduci le chiamate curl documentate e conferma il completamento quando siano coperti alias compatibili, un nome di risposta coerente e l'aggiornamento richiesto del changelog senza compromettere i client esistenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
The CustomAlerts plugin diverges from the conventions used everywhere else in the Matomo Reporting API in two ways:
- Singular vs plural site parameter. Every other entity (
Goals,Segments,Annotations,ScheduledReports, ...) usesidSite(singular, scalar).CustomAlerts.addAlertandCustomAlerts.editAlertinstead requireidSites(plural, array). - camelCase vs snake_case in the response.
CustomAlerts.getAlertssurfaces the same field asid_sites(snake_case, plural, array) in the response payload, while the mutation endpoints expectidSites(camelCase). A consumer cannot blindly round-trip a list response back into aneditAlertcall.
Reproduction
# 1. List alerts, observe the response key is `id_sites`
curl -s "https://demo.example.org/index.php" \
-d "module=API" \
-d "method=CustomAlerts.getAlerts" \
-d "format=JSON" \
-d "token_auth=$TOKEN"
# => [{ "idalert": 1, "id_sites": [1, 2], ... }]
# 2. Try to edit using the response keys verbatim, fails
curl -s "https://demo.example.org/index.php" \
-d "module=API" \
-d "method=CustomAlerts.editAlert" \
-d "idAlert=1" \
-d "id_sites[]=1" \
-d "format=JSON" \
-d "token_auth=$TOKEN"
# => { "result": "error", "message": "Please specify a value for idSites" }
# 3. Same call with `idSites[]=1` works
Expected
Either:
- The response uses
idSites(matching the input contract), or - The input accepts
id_sitesas an alias.
And the idSites (plural) parameter should ideally accept the canonical idSite (singular) like the rest of the API, even if only as an alias for backwards compatibility.
Actual
Consumers must implement a CustomAlerts-specific translation layer just to mirror the data they just read.
Suggested fix
- Accept both
idSiteandidSiteson input (alias). DocumentidSiteas preferred, deprecateidSites. - Return the field as
idSites(camelCase) ingetAlerts, keepid_sitesas a short-term alias. - Tag the change in the plugin changelog so consumers can detect the version cutoff.
Impact
Every Matomo client library has to special-case CustomAlerts. Centralizing the rename reduces consumer code across the ecosystem.
- Lingua principale
- PHP
- Stelle
- 17
- Fork
- 24
- Merge medio
- 1g 6h
- PR unite (30g)
- 7
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di matomo-org/plugin-CustomAlerts
-
bug triaged
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
matomo-org/plugin-CustomAlerts#170 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
matomo-org/plugin-CustomAlerts#142 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
matomo-org/plugin-CustomAlerts#134 · 1 commento ·
-
c: Privacy enhancement triaged
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
matomo-org/plugin-CustomAlerts#119 · 1 commento ·
Tutte le issue di matomo-org/plugin-CustomAlerts
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
help wanted
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
the-benchmarker/web-frameworks#10153 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
FreeCAD/FreeCAD-Homepage#366 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
unopim/shopify-connector#55 ·