PartnerController API Documentation - Endurancezone-com/API-docs GitHub Wiki

Partner API Documentation

This document provides documentation for the Partner API endpoints available in the Points.Api system.

Table of Contents

Authentication

Most endpoints in the Partner API require JWT Bearer authentication. Include the JWT token in the Authorization header of your requests:

Authorization: Bearer {your_jwt_token}

Endpoints

Get Active Partner Notifications For User

Retrieves active notifications for a specific user from a partner.

URL: /api/Partner/{partnerId}/notifications/user/{userId}

Method: GET

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • partnerId (long) - ID of the partner
  • userId (long) - ID of the user

Success Response:

  • Code: 200 OK
  • Content: List of active notifications

Example Request:

GET /api/Partner/123/notifications/user/456 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Example Response:

[
  {
    "id": 1,
    "title": "New Challenge Available",
    "message": "A new fitness challenge is now available!",
    "isRead": false,
    "createdDate": "2025-03-20T15:30:00Z"
  },
  {
    "id": 2,
    "title": "Points Update",
    "message": "You have earned 50 new points!",
    "isRead": true,
    "createdDate": "2025-03-19T10:15:00Z"
  }
]

Get Partner Activities

Retrieves all activities for a partner.

URL: /api/Partner/{partnerId}/activity

Method: GET

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • partnerId (long) - ID of the partner

Success Response:

  • Code: 200 OK
  • Content: List of partner activities

Example Request:

GET /api/Partner/123/activity HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Example Response:

[
  {
    "id": 1,
    "name": "Running",
    "description": "Running activity",
    "pointsPerUnit": 10,
    "unit": "km",
    "isActive": true
  },
  {
    "id": 2,
    "name": "Cycling",
    "description": "Cycling activity",
    "pointsPerUnit": 5,
    "unit": "km",
    "isActive": true
  }
]

Get Partner By Slug

Retrieves partner information using a URL slug.

URL: /api/Partner/{slug}/slug

Method: GET

Auth required: No

URL Parameters:

  • slug (string) - URL slug of the partner

Success Response:

  • Code: 200 OK
  • Content: Partner information

Example Request:

GET /api/Partner/fitness-partner/slug HTTP/1.1
Host: your-api-domain.com

Example Response:

{
  "id": 123,
  "partnerName": "Fitness Partner",
  "description": "A fitness rewards program",
  "logoUrl": "https://example.com/logo.png",
  "websiteUrl": "https://fitnesspartner.com",
  "isActive": true
}

Get Partner Flags

Retrieves configuration flags for a partner.

URL: /api/Partner/{partnerId}/flags

Method: GET

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • partnerId (long) - ID of the partner

Success Response:

  • Code: 200 OK
  • Content: Partner flags configuration

Example Request:

GET /api/Partner/123/flags HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Example Response:

{
  "enableRewards": true,
  "enableLeaderboards": true,
  "enableChallenges": false,
  "enableNotifications": true,
  "maxPointsPerDay": 1000
}

Update User Notifications

Updates notification settings for a user.

URL: /api/Partner/{partnerId}/notifications/user/{userId}

Method: PUT

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • partnerId (long) - ID of the partner
  • userId (long) - ID of the user

Request Body:

{
  "enableEmailNotifications": true,
  "enablePushNotifications": false,
  "notificationTypes": ["rewards", "challenges", "leaderboards"]
}

Success Response:

  • Code: 200 OK
  • Content: Updated notification settings

Example Request:

PUT /api/Partner/123/notifications/user/456 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json

{
  "enableEmailNotifications": true,
  "enablePushNotifications": false,
  "notificationTypes": ["rewards", "challenges", "leaderboards"]
}

Example Response:

{
  "success": true,
  "message": "Notification settings updated successfully"
}

Update Specific User Notification

Updates a specific notification for a user.

URL: /api/Partner/{partnerId}/notifications/{id}/user/{userId}

Method: PUT

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • partnerId (long) - ID of the partner
  • userId (long) - ID of the user
  • id (long) - ID of the notification

Request Body:

{
  "isRead": true,
  "isArchived": false
}

Success Response:

  • Code: 200 OK
  • Content: Updated notification

Example Request:

PUT /api/Partner/123/notifications/789/user/456 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json

{
  "isRead": true,
  "isArchived": false
}

Example Response:

{
  "success": true,
  "message": "Notification updated successfully"
}
⚠️ **GitHub.com Fallback** ⚠️