Notifications¶
- GET /api/notifications¶
Obtenir les notifications de l’utilisateur authentifié.
Scope :
notifications:read
Exemple de requêtes :
sans paramètres :
GET /api/notifications HTTP/1.1
avec quelques paramètres de requête :
GET /api/notifications?page=2&status=unread HTTP/1.1
Exemple de réponses :
renvoyant au moins une notification :
HTTP/1.1 200 OK Content-Type: application/json { "notifications": [ { "created_at": "Wed, 04 Dec 2024 10:06:35 GMT", "from": { "created_at": "Wed, 04 Dec 2024 09:07:08 GMT", "followers": 0, "following": 0, "follows": "pending", "is_followed_by": "false", "nb_workouts": 0, "picture": true, "role": "admin", "suspended_at": null, "username": "admin" }, "id": "be26f35a-1239-44ff-a012-12fb835fa26c", "marked_as_read": false, "type": "follow_request" } ], "pagination": { "has_next": false, "has_prev": false, "page": 1, "pages": 1, "total": 1 }, "status": "success" }
renvoyant aucune notification
HTTP/1.1 200 OK Content-Type: application/json { "notifications": [], "pagination": { "has_next": false, "has_prev": false, "page": 1, "pages": 0, "total": 0 }, "status": "success" }
- Paramètres de requête:
page (integer) – page si pagination (par défaut : 1)
order (string) – ordre de tri :
asc
,desc
(par défaut :desc
)status (string) – état de lecture de la notification (
read
,unread
)
- En-têtes de requête:
Authorization – Jeton “OAuth 2.0 Bearer”
- Codes d’état:
200 OK –
success
provide a valid auth token
signature expired, please log in again
invalid token, please log in again
you do not have permissions, your account is suspended
- PATCH /api/notifications/(string: notification_id)¶
Mettre à jour l’état de lecture de la notification reçue par l’utilisateur authentifié.
Scope :
notifications:write
Exemple de requête :
PATCH /api/notifications/be26f35a-1239-44ff-a012-12fb835fa26c HTTP/1.1
Exemple de réponse :
HTTP/1.1 200 OK Content-Type: application/json { "notification": { "created_at": "Wed, 04 Dec 2024 10:06:35 GMT", "from": { "created_at": "Wed, 04 Dec 2024 09:07:08 GMT", "followers": 0, "following": 0, "follows": "pending", "is_followed_by": "false", "nb_workouts": 0, "picture": true, "role": "admin", "suspended_at": null, "username": "admin" }, "id": "be26f35a-1239-44ff-a012-12fb835fa26c", "marked_as_read": true, "type": "follow_request" }, "status": "success" }
- Paramètres:
notification_id (string) – identifiant court de la notification
- Objet JSON de requête:
read_status (boolean) – état de lecture de la notification
- En-têtes de requête:
Authorization – Jeton “OAuth 2.0 Bearer”
- Codes d’état:
200 OK –
success
provide a valid auth token
signature expired, please log in again
invalid token, please log in again
you do not have permissions, your account is suspended
notification not found
error, please try again or contact the administrator
- GET /api/notifications/unread¶
Obtenir si des notifications non lues existent pour l’utilisateur authentifié.
Scope :
notifications:read
Exemple de requête :
GET /api/notifications/unread HTTP/1.1
Exemple de réponse :
HTTP/1.1 200 OK Content-Type: application/json { "status": "success", "unread": false }
- En-têtes de requête:
Authorization – Jeton “OAuth 2.0 Bearer”
- Codes d’état:
200 OK –
success
provide a valid auth token
signature expired, please log in again
invalid token, please log in again
you do not have permissions, your account is suspended
- POST /api/notifications/mark-all-as-read¶
Marquer tous les notifications de l’utilisateur authentifié comme lues.
Scope :
notifications:write
Exemple de requête :
POST /api/notifications/mark-all-as-read HTTP/1.1
Exemple de réponse :
HTTP/1.1 200 OK Content-Type: application/json { "status": "success" }
- Objet JSON de requête:
type (boolean) – type de notifications (optionnel)
- En-têtes de requête:
Authorization – Jeton “OAuth 2.0 Bearer”
- Codes d’état:
200 OK –
success
provide a valid auth token
signature expired, please log in again
invalid token, please log in again
you do not have permissions, your account is suspended
error, please try again or contact the administrator
- GET /api/notifications/types¶
Obtenir le type des notifications reçues de l’utilisateur authentifié.
Scope :
notifications:read
Exemple de requêtes :
sans paramètres :
GET /api/notifications/types HTTP/1.1
avec le paramètre de requête :
GET /api/notifications/types?status=unread HTTP/1.1
Exemple de réponse :
HTTP/1.1 200 OK Content-Type: application/json { "notification_types": [ "mention" ], "status": "success" }
- Paramètres de requête:
status (string) – état de lecture de la notification (
read
,unread
)
- En-têtes de requête:
Authorization – Jeton “OAuth 2.0 Bearer”
- Codes d’état:
200 OK –
success
provide a valid auth token
signature expired, please log in again
invalid token, please log in again
you do not have permissions, your account is suspended