Skip to content

Commit 6bbbaea

Browse files
Add team membership write endpoint to Preview spec (#619)
1 parent 833cbe6 commit 6bbbaea

1 file changed

Lines changed: 200 additions & 0 deletions

File tree

descriptions/0/api.intercom.io.yaml

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21281,6 +21281,173 @@ paths:
2128121281
message: Access Token Invalid
2128221282
schema:
2128321283
"$ref": "#/components/schemas/error"
21284+
put:
21285+
summary: Update a team's members
21286+
parameters:
21287+
- name: Intercom-Version
21288+
in: header
21289+
schema:
21290+
"$ref": "#/components/schemas/intercom_version"
21291+
- name: id
21292+
in: path
21293+
required: true
21294+
description: The unique identifier of a given team.
21295+
example: '123'
21296+
schema:
21297+
type: string
21298+
tags:
21299+
- Teams
21300+
operationId: updateTeamMembers
21301+
description: |-
21302+
You can replace the set of teammates who belong to a team. Send the full list of
21303+
teammates the team should end up with — any teammate currently on the team and
21304+
missing from the list is removed. This makes the endpoint safe to call on a
21305+
schedule to keep Intercom in step with an external rota or workforce management
21306+
system, since sending an unchanged list makes no changes at all.
21307+
21308+
A token that acts on behalf of a teammate carries that teammate's permissions:
21309+
they must be able to manage teams, and any team or teammate their access is
21310+
restricted from remains out of reach here.
21311+
requestBody:
21312+
content:
21313+
application/json:
21314+
examples:
21315+
successful:
21316+
value:
21317+
admin_ids:
21318+
- 493881
21319+
- 493882
21320+
schema:
21321+
"$ref": "#/components/schemas/update_team_members_request"
21322+
responses:
21323+
'200':
21324+
description: successful
21325+
content:
21326+
application/json:
21327+
examples:
21328+
successful:
21329+
value:
21330+
type: team
21331+
id: '991267902'
21332+
name: team 1
21333+
admin_ids:
21334+
- 493881
21335+
- 493882
21336+
schema:
21337+
"$ref": "#/components/schemas/team"
21338+
'400':
21339+
description: Bad request
21340+
content:
21341+
application/json:
21342+
examples:
21343+
Invalid admin ids:
21344+
value:
21345+
type: error.list
21346+
request_id: 8ba1e2a4-3d6f-4a1e-9c07-52c8f5b0d1aa
21347+
errors:
21348+
- code: parameter_invalid
21349+
message: admin_ids must contain only numeric admin ids
21350+
Field cannot be updated:
21351+
value:
21352+
type: error.list
21353+
request_id: 1c9d6f0b-7a24-4b8e-9f31-3e5a2c6b8d70
21354+
errors:
21355+
- code: parameter_invalid
21356+
message: Only admin_ids can be updated on a team, but the request
21357+
changed name
21358+
schema:
21359+
"$ref": "#/components/schemas/error"
21360+
'403':
21361+
description: |-
21362+
Two codes are returned here and they mean different things. `api_plan_restricted`
21363+
means the endpoint is not available to this workspace at all, so no request will
21364+
succeed until it is enabled. `forbidden` means the workspace has the endpoint but
21365+
the teammate this token acts for may not make this particular change.
21366+
content:
21367+
application/json:
21368+
examples:
21369+
Not available for this workspace:
21370+
value:
21371+
type: error.list
21372+
request_id: 2f7b9c04-8e15-4a63-b0d7-6c41e9a3f582
21373+
errors:
21374+
- code: api_plan_restricted
21375+
message: Updating team memberships via the API is not available
21376+
for this workspace
21377+
Forbidden:
21378+
value:
21379+
type: error.list
21380+
request_id: 4dd0f4f7-2d4b-4d2f-8b98-cf1e7ba1b2c5
21381+
errors:
21382+
- code: forbidden
21383+
message: You don't have permission to update the members of
21384+
this team
21385+
Cannot manage teams:
21386+
value:
21387+
type: error.list
21388+
request_id: 6b2c8e1d-4f39-4d70-8a52-9c7e1f3b0a44
21389+
errors:
21390+
- code: forbidden
21391+
message: You don't have permission to manage teams in this workspace
21392+
schema:
21393+
"$ref": "#/components/schemas/error"
21394+
'404':
21395+
description: Team not found
21396+
content:
21397+
application/json:
21398+
examples:
21399+
Team not found:
21400+
value:
21401+
type: error.list
21402+
request_id: 9a3e0b1c-6f27-4f5e-8c31-0f2f4a7d9e88
21403+
errors:
21404+
- code: team_not_found
21405+
message: Team not found
21406+
schema:
21407+
"$ref": "#/components/schemas/error"
21408+
'409':
21409+
description: |-
21410+
Another request is already changing this team's members. Two cases are
21411+
distinguished by the message: the request was declined before anything was
21412+
written, so the team is unchanged and the same request can simply be sent
21413+
again; or the members kept changing while the request was being applied, so
21414+
it is partly applied and the team should be read again before retrying.
21415+
content:
21416+
application/json:
21417+
examples:
21418+
Conflict:
21419+
value:
21420+
type: error.list
21421+
request_id: 5e7a0c3f-8b16-4d92-a7c4-2f8b6d0e9137
21422+
errors:
21423+
- code: conflict
21424+
message: The members of this team are being changed by another
21425+
request. Try again.
21426+
Partly applied:
21427+
value:
21428+
type: error.list
21429+
request_id: 5e7a0c3f-8b16-4d92-a7c4-2f8b6d0e9137
21430+
errors:
21431+
- code: conflict
21432+
message: The members of this team kept being changed by other
21433+
requests, so this one is partly applied. Read the team and
21434+
try again.
21435+
schema:
21436+
"$ref": "#/components/schemas/error"
21437+
'401':
21438+
description: Unauthorized
21439+
content:
21440+
application/json:
21441+
examples:
21442+
Unauthorized:
21443+
value:
21444+
type: error.list
21445+
request_id: 6c1e2f83-5b47-4f0e-9d8a-3b2c1e4f7a90
21446+
errors:
21447+
- code: unauthorized
21448+
message: Access Token Invalid
21449+
schema:
21450+
"$ref": "#/components/schemas/error"
2128421451
"/ticket_states":
2128521452
get:
2128621453
summary: List all ticket states
@@ -40514,6 +40681,39 @@ components:
4051440681
- url
4051540682
- locale
4051640683
- source_id
40684+
update_team_members_request:
40685+
description: |
40686+
The request payload for updating a team's membership.
40687+
`admin_ids` is the complete set of teammates who should be on the team once
40688+
the request completes, not a list of changes to apply. Any teammate currently
40689+
on the team but absent from `admin_ids` is removed.
40690+
40691+
Membership is the only part of a team this endpoint writes, and the request is
40692+
read from the body: a parameter sent in the query string is rejected rather than
40693+
applied. A team read from the API can be sent back whole, since the other fields
40694+
of the representation are accepted as long as they are unchanged. Trying to
40695+
change one of them returns a 400 rather than being ignored, as does any field a
40696+
team does not have.
40697+
40698+
On a team that balances assignment across its members, teammates already on the
40699+
team keep their current priority level and teammates being added join as primary
40700+
members. Priority levels cannot be set here, so `admin_priority_level` follows
40701+
from `admin_ids`: it is accepted when sent back unchanged and returns a 400 when
40702+
the request tries to change it.
40703+
type: object
40704+
title: Update Team Members Request Payload
40705+
properties:
40706+
admin_ids:
40707+
type: array
40708+
description: The ids of every teammate who should be a member of the team.
40709+
Must contain at least one id, and no more than 1000.
40710+
items:
40711+
type: integer
40712+
example:
40713+
- 493881
40714+
- 493882
40715+
required:
40716+
- admin_ids
4051740717
update_ticket_request:
4051840718
description: You can update a Ticket
4051940719
type: object

0 commit comments

Comments
 (0)