curl -X PATCH 'https://api.weir.ai/org/team/team_123456789/member/user_987654321' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"role": "Team_Lead"
}'
{
"data": {
"userId": "user_987654321",
"teamId": "team_123456789",
"role": "Team_Lead",
"updatedAt": "2024-01-22T15:30:00Z"
},
"message": "Member role updated successfully",
"status": "success"
}
Update the role of a team member
curl -X PATCH 'https://api.weir.ai/org/team/team_123456789/member/user_987654321' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"role": "Team_Lead"
}'
{
"data": {
"userId": "user_987654321",
"teamId": "team_123456789",
"role": "Team_Lead",
"updatedAt": "2024-01-22T15:30:00Z"
},
"message": "Member role updated successfully",
"status": "success"
}
curl -X PATCH 'https://api.weir.ai/org/team/team_123456789/member/user_987654321' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"role": "Team_Lead"
}'
{
"data": {
"userId": "user_987654321",
"teamId": "team_123456789",
"role": "Team_Lead",
"updatedAt": "2024-01-22T15:30:00Z"
},
"message": "Member role updated successfully",
"status": "success"
}
x-source: console header.
const updateMemberRole = async (teamId, memberId, newRole, accessToken) => {
try {
const response = await fetch(
`https://api.weir.ai/org/team/${teamId}/member/${memberId}`,
{
method: 'PATCH',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'x-source': 'console'
},
body: JSON.stringify({ role: newRole })
}
);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data.data;
} catch (error) {
console.error('Update member role error:', error);
throw error;
}
};
// Usage
const updatedMember = await updateMemberRole(
'team_123456789',
'user_987654321',
'Team_Lead',
'your_access_token'
);
console.log('Role updated to:', updatedMember.role);
Was this page helpful?