API Reference - User Services

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108071

← Back to API Reference | Getting Started

User Services

User Services links members to the specific services they offer on the directory. Each record associates a member with a service category and optionally captures pricing, completion count, and specialty status for that service.

Model name in URL: rel_services — DB table: rel_services

The User Services Object

FieldTypeDescription
rel_idintegerUnique service relationship record ID (primary key, read-only)
user_idintegerID of the member offering this service (foreign key to users)
service_idintegerID of the service being offered (foreign key to the services reference table)
datestringDate this service relationship was created, formatted as YYYYMMDDHHmmss
avg_pricenumberAverage price the member charges for this service (decimal with 2 decimal places)
num_completedstringNumber of times the member has completed this service
specialtyintegerWhether this is a specialty service for the member (0 = no, 1 = yes)

List User Service Records

GET /api/v2/rel_services/get

Returns a paginated list of user service records.

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/rel_services/get?limit=25" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "tablesExists": true,
      "rel_id": "3",
      "user_id": "38",
      "service_id": "1",
      "date": "20221108075516",
      "avg_price": "0.00",
      "num_completed": "",
      "specialty": "0"
    },
    {
      "tablesExists": true,
      "rel_id": "4",
      "user_id": "35",
      "service_id": "354",
      "date": "20230727072211",
      "avg_price": "0.00",
      "num_completed": "",
      "specialty": "0"
    }
  ],
  "total": "28",
  "current_page": 1,
  "total_pages": 14,
  "next_page": "MipfKjI="
}

Retrieve a User Service Record

GET /api/v2/rel_services/get/{rel_id}

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/rel_services/get/3" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "tablesExists": true,
      "rel_id": "3",
      "user_id": "38",
      "service_id": "1",
      "date": "20221108075516",
      "avg_price": "0.00",
      "num_completed": "",
      "specialty": "0"
    }
  ],
  "total": "28",
  "current_page": 1,
  "total_pages": 2,
  "next_page": "MipfKjI1"
}

Create a User Service Record

POST /api/v2/rel_services/create

Links a service to a member's profile.

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/rel_services/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "user_id=1" \
  -d "service_id=10" \
  -d "date=20260403000000" \
  -d "avg_price=50.00" \
  -d "specialty=1"

Example Response

Copy
{
  "status": "success",
  "message": {
    "rel_id": "910003",
    "user_id": "1",
    "service_id": "10",
    "date": "20260403000000",
    "avg_price": "50.00",
    "num_completed": null,
    "specialty": "1"
  }
}

Update a User Service Record

PUT /api/v2/rel_services/update

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/rel_services/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "rel_id=910003" \
  -d "avg_price=75.00"

Example Response

Copy
{
  "status": "success",
  "message": {
    "rel_id": "910003",
    "user_id": "1",
    "service_id": "10",
    "date": "20260403000000",
    "avg_price": "75.00",
    "num_completed": "",
    "specialty": "1"
  }
}

Delete a User Service Record

DELETE /api/v2/rel_services/delete

Example Request

Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/rel_services/delete" \
  -H "X-Api-Key: your-api-key-here" \
  -d "rel_id=910003"

Example Response

Copy
{
  "status": "success",
  "message": "rel_services record was deleted"
}