dambel

دمبل

shevron
ورود | ثبت نام

API Docs / tracker / shares / create



POST /api/v1/tracker/shares

Create a new shared tracker configuration to share tracker data with another user.


Permissions

PermissionDescription
shared_trackers.createCreate shared tracker

Request Body Parameters

NameTypeRequiredDescription
viewer_user_idintegerYesID of the user to share tracker data with
start_datestringYesStart date for the sharing period (YYYY-MM-DD format)
end_datestringYesEnd date for the sharing period (YYYY-MM-DD format)
include_wakeupbooleanNoWhether to include wakeup data (default: true)
include_weightbooleanNoWhether to include weight data (default: true)
include_waterbooleanNoWhether to include water intake data (default: true)
include_sleepbooleanNoWhether to include sleep data (default: true)
include_supplementbooleanNoWhether to include supplement data (default: true)
include_mealbooleanNoWhether to include meal data (default: true)
include_workoutbooleanNoWhether to include workout data (default: true)
descriptionstringNoOptional description for the shared tracker (max: 2000 characters)

Response

201 Created

<shared tracker resource>

Error Responses

StatusError TypeReference
422Validation ErrorValidation error
401UnauthorizedAuthentication error
403ForbiddenPermission error

Example Request

curl -X POST "https://api.example.com/api/v1/tracker/shares" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "viewer_user_id": 456,
    "start_date": "2024-01-01",
    "end_date": "2024-01-31",
    "description": "January fitness tracking data",
    "include_wakeup": true,
    "include_weight": false,
    "include_water": true,
    "include_sleep": true,
    "include_supplement": false,
    "include_meal": true,
    "include_workout": true
  }'

Example Response

{
  "data": <shared tracker resource>
}

See Shared Tracker Resource for the complete response structure.


Notes

  • The user_id is automatically set to the authenticated user's ID
  • All include_* flags default to true if not specified
  • All notify_* flags default to false if not specified
  • The end_date must be after the start_date
  • The viewer_user_id must reference an existing user
footer wave
logo

دمبل، دنیای هوشمند ورزش و تغذیه

LinkedinInstagramXYoutube