Skip to content

UsersPointsController API Documentation

lsambridge edited this page Mar 25, 2025 · 2 revisions

Users Points API Documentation

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

Table of Contents

Authentication

All endpoints in this API require JWT Bearer authentication. Include a valid JWT token in the Authorization header of your requests.

Authorization: Bearer {your_jwt_token}

Endpoints

Get All User Point Sets By Partner And Month

Retrieves point sets for all users of a specific partner for a given month, excluding a specified user.

URL: /api/UsersPoints/partner/{partnerId}/month/{date}/allusers/{ignoreUserId}

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • partnerId (long) - The ID of the partner
  • date (DateTime) - The date to filter by (month/year)
  • ignoreUserId (long) - The ID of the user to exclude from results

Success Response:

Example Request:

GET /api/UsersPoints/partner/123/month/2025-03-01/allusers/456 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

[
  {
    "activityName": "Running",
    "totalPoints": 250,
    "user": {
      "id": 789,
      "firstName": "John",
      "lastName": "Doe",
      "email": "john.doe@example.com"
    }
  },
  {
    "activityName": "Cycling",
    "totalPoints": 180,
    "user": {
      "id": 790,
      "firstName": "Jane",
      "lastName": "Smith",
      "email": "jane.smith@example.com"
    }
  }
]

Get All User Point Sets By Partner And Month Spread

Retrieves point sets spread data for all users of a specific partner for a given month, excluding a specified user.

URL: /api/UsersPoints/partner/{partnerId}/month/{date}/allusers/{ignoreUserId}/spread

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • partnerId (long) - The ID of the partner
  • date (DateTime) - The date to filter by (month/year)
  • ignoreUserId (long) - The ID of the user to exclude from results

Success Response:

Example Request:

GET /api/UsersPoints/partner/123/month/2025-03-01/allusers/456/spread HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

[
  {
    "activityName": "Running",
    "spreads": [
      {
        "averagePoints": 25.5,
        "totalPoints": 255
      },
      {
        "averagePoints": 18.2,
        "totalPoints": 182
      }
    ]
  },
  {
    "activityName": "Cycling",
    "spreads": [
      {
        "averagePoints": 30.0,
        "totalPoints": 300
      },
      {
        "averagePoints": 22.5,
        "totalPoints": 225
      }
    ]
  }
]

Get Device Data

Retrieves device data for a specific point set.

URL: /api/UsersPoints/devicedata/{pointsSetId}

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • pointsSetId (long) - The ID of the point set

Success Response:

Example Request:

GET /api/UsersPoints/devicedata/123 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

{
  "id": 123,
  "dateCreated": "2025-03-15T10:30:00Z",
  "expiryDate": "2026-03-15T10:30:00Z",
  "description": "Running activity",
  "hasMapData": true,
  "points": [
    {
      "id": 456,
      "dateCreated": "2025-03-15T10:30:00Z",
      "totalPointValue": 100,
      "totalPointsUsed": 0,
      "totalPointsLeft": 100
    }
  ],
  "activityType": {
    "id": 1,
    "name": "Running"
  },
  "userDeviceData": {
    "distance": 5000,
    "duration": 1800,
    "calories": 450,
    "averageHeartRate": 145
  },
  "devicePointSetSummary": [
    {
      "fieldName": "Distance",
      "value": "5 km"
    },
    {
      "fieldName": "Duration",
      "value": "30 min"
    }
  ]
}

Get User Device Data And Values

Retrieves device data and values for a specific user and partner.

URL: /api/UsersPoints/partner/{partnerId}/devicedataandvalues/{userId}

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

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

Success Response:

Example Request:

GET /api/UsersPoints/partner/123/devicedataandvalues/456 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

[
  {
    "id": 789,
    "dateCreated": "2025-03-15T10:30:00Z",
    "expiryDate": "2026-03-15T10:30:00Z",
    "description": "Running activity",
    "hasMapData": true,
    "points": [
      {
        "id": 101,
        "dateCreated": "2025-03-15T10:30:00Z",
        "totalPointValue": 100,
        "totalPointsUsed": 0,
        "totalPointsLeft": 100
      }
    ],
    "activityType": {
      "id": 1,
      "name": "Running"
    },
    "userDeviceData": {
      "distance": 5000,
      "duration": 1800,
      "calories": 450,
      "averageHeartRate": 145
    }
  }
]

Get User Points By Bucket

Retrieves point sets for a specific user filtered by bucket.

URL: /api/UsersPoints/{userId}/Bucket/{bucketId}

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user
  • bucketId (long) - The ID of the bucket

Success Response:

Example Request:

GET /api/UsersPoints/456/Bucket/789 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

[
  {
    "id": 123,
    "dateCreated": "2025-03-15T10:30:00Z",
    "expiryDate": "2026-03-15T10:30:00Z",
    "description": "Running activity",
    "points": [
      {
        "id": 456,
        "dateCreated": "2025-03-15T10:30:00Z",
        "totalPointValue": 100,
        "totalPointsUsed": 0,
        "totalPointsLeft": 100
      }
    ],
    "activityType": {
      "id": 1,
      "name": "Running"
    }
  }
]

Get User Point Sets

Retrieves all point sets for a specific user.

URL: /api/UsersPoints/{userId}

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user

Success Response:

Example Request:

GET /api/UsersPoints/456 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

{
  "id": 456,
  "firstName": "John",
  "lastName": "Doe",
  "email": "john.doe@example.com",
  "username": "johndoe",
  "dateJoined": "2024-01-15T08:30:00Z",
  "isActive": true,
  "partnerId": 123,
  "pointSets": [
    {
      "id": 789,
      "dateCreated": "2025-03-15T10:30:00Z",
      "expiryDate": "2026-03-15T10:30:00Z",
      "description": "Running activity",
      "points": [
        {
          "id": 101,
          "dateCreated": "2025-03-15T10:30:00Z",
          "totalPointValue": 100,
          "totalPointsUsed": 0,
          "totalPointsLeft": 100
        }
      ],
      "activityType": {
        "id": 1,
        "name": "Running"
      }
    }
  ],
  "competitionsEntered": 5,
  "leaderBoardsEntered": 3,
  "rewardsUnlocked": 2
}

Get User Point Sets Paged

Retrieves paged point sets for a specific user.

URL: /api/UsersPoints/{userId}/Paged/

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user

Query Parameters:

  • skip (int) - Number of records to skip
  • pageSize (int) - Number of records to return

Success Response:

  • Code: 200 OK
  • Content: UserResponse object with paged point sets

Example Request:

GET /api/UsersPoints/456/Paged/?skip=0&pageSize=10 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

{
  "id": 456,
  "firstName": "John",
  "lastName": "Doe",
  "email": "john.doe@example.com",
  "username": "johndoe",
  "dateJoined": "2024-01-15T08:30:00Z",
  "isActive": true,
  "partnerId": 123,
  "pointSets": [
    {
      "id": 789,
      "dateCreated": "2025-03-15T10:30:00Z",
      "description": "Running activity",
      "points": [
        {
          "id": 101,
          "totalPointValue": 100,
          "totalPointsUsed": 0,
          "totalPointsLeft": 100
        }
      ]
    }
  ]
}

Get User Point Sets By Activity

Retrieves point sets for a specific user filtered by activity type.

URL: /api/UsersPoints/{userId}/activity/{activityId}

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user
  • activityId (long) - The ID of the activity type

Success Response:

  • Code: 200 OK
  • Content: Array of AccountsPointSets objects

Example Request:

GET /api/UsersPoints/456/activity/1 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

[
  {
    "id": 789,
    "dateCreated": "2025-03-15T10:30:00Z",
    "expiryDate": "2026-03-15T10:30:00Z",
    "description": "Running activity",
    "points": [
      {
        "id": 101,
        "totalPointValue": 100,
        "totalPointsUsed": 0
      }
    ],
    "activityType": {
      "id": 1,
      "name": "Running"
    }
  }
]

Get User Point Sets Active

Retrieves active point sets for a specific user.

URL: /api/UsersPoints/{userId}/current

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user

Success Response:

  • Code: 200 OK
  • Content: User object with active point sets

Example Request:

GET /api/UsersPoints/456/current HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

{
  "id": 456,
  "firstName": "John",
  "lastName": "Doe",
  "email": "john.doe@example.com",
  "username": "johndoe",
  "isActive": true,
  "pointSets": [
    {
      "id": 789,
      "dateCreated": "2025-03-15T10:30:00Z",
      "description": "Running activity",
      "points": [
        {
          "totalPointValue": 100,
          "totalPointsUsed": 0
        }
      ]
    }
  ]
}

Get User Point Sets Active By Activity

Retrieves active point sets for a specific user filtered by activity type.

URL: /api/UsersPoints/{userId}/current/activity/{activityId}

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user
  • activityId (long) - The ID of the activity type

Success Response:

  • Code: 200 OK
  • Content: Array of AccountsPointSets objects (active only)

Example Request:

GET /api/UsersPoints/456/current/activity/1 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

[
  {
    "id": 789,
    "dateCreated": "2025-03-15T10:30:00Z",
    "description": "Running activity",
    "points": [
      {
        "totalPointValue": 100,
        "totalPointsUsed": 0
      }
    ],
    "activityType": {
      "id": 1,
      "name": "Running"
    }
  }
]

Get User Point Sets By Partner

Retrieves point sets for a specific user filtered by partner.

URL: /api/UsersPoints/{userId}/partner/{partnerId}

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

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

Success Response:

  • Code: 200 OK
  • Content: Array of AccountsPointSets objects

Example Request:

GET /api/UsersPoints/456/partner/123 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

[
  {
    "id": 789,
    "dateCreated": "2025-03-15T10:30:00Z",
    "description": "Running activity",
    "points": [
      {
        "totalPointValue": 100,
        "totalPointsUsed": 0
      }
    ]
  }
]

Get User Point Sets By Reward

Retrieves point sets for a specific user filtered by reward.

URL: /api/UsersPoints/{userId}/reward/{rewardId}

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user
  • rewardId (long) - The ID of the reward

Success Response:

  • Code: 200 OK
  • Content: Array of AccountsPointSets objects

Example Request:

GET /api/UsersPoints/456/reward/789 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

[
  {
    "id": 101,
    "dateCreated": "2025-03-15T10:30:00Z",
    "description": "Reward points",
    "points": [
      {
        "totalPointValue": 50,
        "totalPointsUsed": 0
      }
    ],
    "reward": {
      "id": 789,
      "title": "Premium Subscription"
    }
  }
]

Get User Point Sets By Source

Retrieves point sets for a specific user filtered by source.

URL: /api/UsersPoints/{userId}/source/{sourceId}

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user
  • sourceId (long) - The ID of the source

Success Response:

  • Code: 200 OK
  • Content: Array of AccountsPointSets objects

Example Request:

GET /api/UsersPoints/456/source/789 HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

[
  {
    "id": 101,
    "dateCreated": "2025-03-15T10:30:00Z",
    "description": "Source points",
    "points": [
      {
        "totalPointValue": 75,
        "totalPointsUsed": 0
      }
    ],
    "pointSource": {
      "id": 789,
      "name": "Strava"
    }
  }
]

Get User Point Sets History

Retrieves point sets history for a specific user.

URL: /api/UsersPoints/{userId}/history

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user

Success Response:

Example Request:

GET /api/UsersPoints/456/history HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

[
  {
    "id": 123,
    "pointsUsed": 50,
    "pointsUsedOn": "2025-03-10T15:30:00Z",
    "pointSet": {
      "id": 789,
      "description": "Running activity"
    },
    "rewardUsedOn": {
      "id": 101,
      "title": "Premium Subscription"
    }
  }
]

Get User Total Points

Retrieves the total points for a specific user.

URL: /api/UsersPoints/{userId}/Total

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user

Success Response:

  • Code: 200 OK
  • Content: Integer representing total points

Example Request:

GET /api/UsersPoints/456/Total HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

350

Get User Total Points Buckets

Retrieves the total points by bucket for a specific user.

URL: /api/UsersPoints/{userId}/Total/Buckets

Method: GET

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user

Success Response:

Example Request:

GET /api/UsersPoints/456/Total/Buckets HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}

Example Response:

[
  {
    "id": 1,
    "name": "Running",
    "description": "Points earned from running activities",
    "points": 150
  },
  {
    "id": 2,
    "name": "Cycling",
    "description": "Points earned from cycling activities",
    "points": 200
  }
]

Update Point Value

Updates point values for a specific user.

URL: /api/UsersPoints/{userId}

Method: POST

Auth required: Yes (JWT Bearer)

URL Parameters:

  • userId (long) - The ID of the user
  • clean (boolean, query parameter) - Whether to clean existing points

Request Body:

Success Response:

  • Code: 200 OK
  • Content: Success message or status

Example Request:

POST /api/UsersPoints/456?clean=false HTTP/1.1
Host: your-api-domain.com
Authorization: Bearer {your_jwt_token}
Content-Type: application/json

{
  "actionValue": 10.5,
  "dateCreated": "2025-03-21T10:30:00Z",
  "description": "Points for completing a challenge",
  "expiryDate": "2026-03-21T10:30:00Z",
  "activityType": {
    "id": 1
  },
  "points": [
    {
      "dateCreated": "2025-03-21T10:30:00Z",
      "totalPointValue": 100,
      "totalPointsUsed": 0
    }
  ],
  "pointSource": {
    "id": 2
  },
  "reward": {
    "id": 3
  },
  "serviceProvider": 1
}

Example Response:

{
  "statusCode": 200,
  "value": "Points updated successfully"
}

Models

PointsUpdateRequest

The PointsUpdateRequest model is used to update point values for a user.

Property Type Description
actionValue decimal? Value of the action that earned points
activityType ActivityTypeRequest Activity type associated with the points (can be null)
dateCreated DateTime Date and time when the points were created
description string Description of the points
expiryDate DateTime? Date and time when the points expire
points List List of point values
pointSource PointsSource Source of the points (can be null)
reward RewardRequest Reward associated with the points (can be null)
serviceProvider ServiceProvider? Service provider associated with the points (can be null)

AccountsPointSetsResponse

The AccountsPointSetsResponse model contains information about a point set.

Property Type Description
id long Unique identifier for the point set
dateCreated DateTime Date and time when the point set was created
expiryDate DateTime? Date and time when the point set expires
description string Description of the point set
hasMapData boolean Whether the point set has map data
points List List of points in the set
activityType ActivityTypeResponse Activity type associated with the point set
pointSource PointsSource Source of the points
reward Reward Reward associated with the points
serviceProvider ServiceProvider? Service provider associated with the points
user User User who owns the point set
userDeviceData UserDeviceData Device data associated with the point set
devicePointSetSummary List Summary of device data
polylinePoints List Map data points

AccountsPointsResponse

The AccountsPointsResponse model contains information about points.

Property Type Description
id long Unique identifier for the points
dateCreated DateTime Date and time when the points were created
totalPointValue int Total value of the points
totalPointsUsed int Number of points used
totalPointsLeft int Number of points remaining

AccountsPointSetsHistoryResponse

The AccountsPointSetsHistoryResponse model contains information about point set history.

Property Type Description
id long Unique identifier for the history record
pointsUsed int Number of points used
pointsUsedOn DateTime Date and time when the points were used
pointSet AccountsPointSetsResponse Point set associated with the history
rewardUsedOn Reward Reward the points were used on
partnerLevelPoint PartnerLevelPointResponse Partner level point associated with the history

PartnerPointComparison

The PartnerPointComparison model contains comparison data for partner points.

Property Type Description
activityName string Name of the activity
totalPoints double Total points for the activity
user User User associated with the points

PartnerPointComparisonSpread

The PartnerPointComparisonSpread model contains spread data for partner point comparisons.

Property Type Description
activityName string Name of the activity
spreads List List of spread details

PointBucketResponse

The PointBucketResponse model contains information about a point bucket.

Property Type Description
id long Unique identifier for the bucket
name string Name of the bucket
description string Description of the bucket
points int Total points in the bucket

UserResponse

The UserResponse model contains information about a user and their point sets.

Property Type Description
id int Unique identifier for the user
firstName string First name of the user
lastName string Last name of the user
email string Email address of the user
username string Username of the user
dateJoined DateTime Date and time when the user joined
isActive boolean Whether the user is active
avatar string URL to the user's avatar
gender string Gender of the user
birthYear int? Birth year of the user
countryId long? ID of the user's country
partnerId long ID of the user's partner
level string Level of the user
pointSets List List of point sets owned by the user
competitionsEntered int Number of competitions entered by the user
leaderBoardsEntered int Number of leaderboards entered by the user
rewardsUnlocked int Number of rewards unlocked by the user
loginUrl string URL for user login
pointsUrl string URL for user points
rewardsUrl string URL for user rewards

Clone this wiki locally