Skip to content

RewardPointsController API Documentation

Lee Sambridge edited this page Mar 21, 2025 · 1 revision

Reward Points API Documentation

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

Table of Contents

Authentication

All endpoints in the Reward Points API require JWT Bearer authentication. Include the JWT token in the Authorization header of your requests:

Authorization: Bearer {your_jwt_token}

Endpoints

Add or Edit Reward

Creates a new reward or updates an existing one.

URL: /api/RewardPoints/{partnerId}

Method: POST

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • partnerId (long) - ID of the partner

Request Body:

{
  "id": 0,
  "name": "Free T-Shirt",
  "description": "Earn a free branded t-shirt",
  "pointsRequired": 500,
  "isActive": true,
  "imageUrl": "https://example.com/tshirt.jpg",
  "quantity": 100
}

Success Response:

  • Code: 200 OK
  • Content: Empty response (implementation appears to be a placeholder)

Example Request:

POST /api/RewardPoints/123 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json

{
  "id": 0,
  "name": "Free T-Shirt",
  "description": "Earn a free branded t-shirt",
  "pointsRequired": 500,
  "isActive": true,
  "imageUrl": "https://example.com/tshirt.jpg",
  "quantity": 100
}

Delete Reward

Deletes a reward.

URL: /api/RewardPoints/{partnerId}/{id}

Method: DELETE

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • partnerId (long) - ID of the partner
  • id (long) - ID of the reward to delete

Success Response:

  • Code: 200 OK
  • Content: Empty response (implementation appears to be a placeholder)

Example Request:

DELETE /api/RewardPoints/123/456 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Get Rewards

Retrieves all rewards for a partner that are available to a specific user.

URL: /api/RewardPoints/{partnerId}

Method: GET

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • partnerId (long) - ID of the partner

Query Parameters:

  • userId (long) - ID of the user

Success Response:

  • Code: 200 OK
  • Content: List of partner rewards available to the user

Example Request:

GET /api/RewardPoints/123?userId=789 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Example Response:

[
  {
    "id": 1,
    "name": "Free T-Shirt",
    "description": "Earn a free branded t-shirt",
    "pointsRequired": 500,
    "isActive": true,
    "imageUrl": "https://example.com/tshirt.jpg",
    "isLocked": false,
    "userPoints": 600
  },
  {
    "id": 2,
    "name": "Gift Card",
    "description": "$25 gift card",
    "pointsRequired": 1000,
    "isActive": true,
    "imageUrl": "https://example.com/giftcard.jpg",
    "isLocked": true,
    "userPoints": 600
  }
]

Get Reward by ID

Retrieves a specific reward by ID with user-specific information.

URL: /api/RewardPoints/{partnerId}/{id}

Method: GET

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • partnerId (long) - ID of the partner
  • id (long) - ID of the reward

Query Parameters:

  • userId (long) - ID of the user

Success Response:

  • Code: 200 OK
  • Content: Reward details with user-specific information

Example Request:

GET /api/RewardPoints/123/456?userId=789 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Example Response:

{
  "id": 456,
  "name": "Free T-Shirt",
  "description": "Earn a free branded t-shirt",
  "pointsRequired": 500,
  "isActive": true,
  "imageUrl": "https://example.com/tshirt.jpg",
  "isLocked": false,
  "userPoints": 600,
  "termsAndConditions": "Offer valid while supplies last. Limit one per customer.",
  "expiryDate": "2025-12-31T23:59:59Z"
}

Get Reward by Reward ID

Retrieves a specific reward by reward ID without user-specific information.

URL: /api/RewardPoints/{partnerId}/reward/{rewardId}

Method: GET

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • partnerId (long) - ID of the partner
  • rewardId (long) - ID of the reward

Success Response:

  • Code: 200 OK
  • Content: Reward details

Example Request:

GET /api/RewardPoints/123/reward/456 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Example Response:

{
  "id": 456,
  "name": "Free T-Shirt",
  "description": "Earn a free branded t-shirt",
  "pointsRequired": 500,
  "isActive": true,
  "imageUrl": "https://example.com/tshirt.jpg",
  "termsAndConditions": "Offer valid while supplies last. Limit one per customer.",
  "expiryDate": "2025-12-31T23:59:59Z"
}

Spend Points on Reward

Allows a user to spend points to unlock a reward.

URL: /api/RewardPoints/{partnerId}/user/{userId}/reward/{rewardId}/points/{points}

Method: PUT

Auth required: Yes (JWT Bearer token)

URL Parameters:

  • partnerId (long) - ID of the partner
  • userId (long) - ID of the user
  • rewardId (long) - ID of the reward
  • points (int) - Number of points to spend

Success Response:

  • Code: 200 OK
  • Content: Result indicating if the user is allowed to unlock the reward

Example Request:

PUT /api/RewardPoints/123/user/789/reward/456/points/500 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Example Response:

{
  "allowedToUnlock": true
}

Clone this wiki locally