Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101462,7 +101462,13 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/UserTeamResponse'
description: Represents a user's association to a team
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: API error response.
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
Expand Down
11 changes: 9 additions & 2 deletions examples/v2/teams/UpdateTeamMembership.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""
Update a user's membership attributes on a team returns "Represents a user's association to a team" response
Update a user's membership attributes on a team returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.teams_api import TeamsApi
from datadog_api_client.v2.model.user_team_attributes import UserTeamAttributes
Expand All @@ -10,6 +11,12 @@
from datadog_api_client.v2.model.user_team_update import UserTeamUpdate
from datadog_api_client.v2.model.user_team_update_request import UserTeamUpdateRequest

# there is a valid "dd_team" in the system
DD_TEAM_DATA_ID = environ["DD_TEAM_DATA_ID"]

# there is a valid "user" in the system
USER_DATA_ID = environ["USER_DATA_ID"]

body = UserTeamUpdateRequest(
data=UserTeamUpdate(
attributes=UserTeamAttributes(
Expand All @@ -22,6 +29,6 @@
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = TeamsApi(api_client)
response = api_instance.update_team_membership(team_id="team_id", user_id="user_id", body=body)
response = api_instance.update_team_membership(team_id=DD_TEAM_DATA_ID, user_id=USER_DATA_ID, body=body)

print(response)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2026-02-12T14:57:57.281Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
interactions:
- request:
body: '{"data":{"attributes":{"handle":"test-handle-d1ea4282abe3f68d","name":"test-name-d1ea4282abe3f68d"},"type":"team"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v2/team
response:
body:
string: '{"data":{"id":"587b5f1a-b8ef-42b7-a99a-746cb80422a4","type":"team","attributes":{"avatar":null,"banner":6,"created_at":"2026-02-12T14:57:57.783497+00:00","description":null,"handle":"test-handle-d1ea4282abe3f68d","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2026-02-12T14:57:57.783497+00:00","name":"test-name-d1ea4282abe3f68d","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/587b5f1a-b8ef-42b7-a99a-746cb80422a4/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/587b5f1a-b8ef-42b7-a99a-746cb80422a4/permission-settings"}}}}}'
headers:
content-type:
- application/vnd.api+json
status:
code: 201
message: Created
- request:
body: '{"data":{"attributes":{"role":"admin"},"type":"team_memberships"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: PATCH
uri: https://api.datadoghq.com/api/v2/team/587b5f1a-b8ef-42b7-a99a-746cb80422a4/memberships/00000000-0000-dead-beef-000000000000
response:
body:
string: '{"errors":["User for ID 00000000-0000-dead-beef-000000000000 not found"]}'
headers:
content-type:
- application/json
status:
code: 404
message: Not Found
- request:
body: null
headers:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/team/587b5f1a-b8ef-42b7-a99a-746cb80422a4
response:
body:
string: ''
headers: {}
status:
code: 204
message: No Content
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2026-02-12T14:59:46.756Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
interactions:
- request:
body: '{"data":{"attributes":{"handle":"test-handle-ae403c8f160ec46f","name":"test-name-ae403c8f160ec46f"},"type":"team"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v2/team
response:
body:
string: '{"data":{"id":"38c0d1d3-69c0-4452-95a0-0115b22f2607","type":"team","attributes":{"avatar":null,"banner":13,"created_at":"2026-02-12T14:59:47.252294+00:00","description":null,"handle":"test-handle-ae403c8f160ec46f","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2026-02-12T14:59:47.252294+00:00","name":"test-name-ae403c8f160ec46f","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607/permission-settings"}}}}}'
headers:
content-type:
- application/vnd.api+json
status:
code: 201
message: Created
- request:
body: '{"data":{"attributes":{"email":"Test-Update_a_user_s_membership_attributes_on_a_team_returns_OK_response-1770908386@datadoghq.com","title":"user
title"},"type":"users"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v2/users
response:
body:
string: '{"data":{"type":"users","id":"3330c2ed-ac5d-458e-875b-ffc85c436edc","attributes":{"name":null,"handle":"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com","created_at":"2026-02-12T14:59:47.812309+00:00","modified_at":"2026-02-12T14:59:47.812309+00:00","email":"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com","icon":"https://secure.gravatar.com/avatar/7906350a0aeb9c3285de81609654b5df?s=48&d=retro","title":"user
title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}}

'
headers:
content-type:
- application/json
status:
code: 201
message: Created
- request:
body: '{"data":{"attributes":{"role":"admin"},"relationships":{"user":{"data":{"id":"3330c2ed-ac5d-458e-875b-ffc85c436edc","type":"users"}}},"type":"team_memberships"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607/memberships
response:
body:
string: '{"data":{"id":"TeamMembership-38c0d1d3-69c0-4452-95a0-0115b22f2607-65393600","type":"team_memberships","attributes":{"provisioned_by":null,"provisioned_by_id":"3ad549bf-eba0-11e9-a77a-0705486660d0","role":"admin"},"relationships":{"user":{"data":{"id":"3330c2ed-ac5d-458e-875b-ffc85c436edc","type":"users"}}}},"included":[{"id":"3330c2ed-ac5d-458e-875b-ffc85c436edc","type":"users","attributes":{"disabled":false,"email":"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com","handle":"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com","icon":"https://secure.gravatar.com/avatar/7906350a0aeb9c3285de81609654b5df?d=retro\u0026s=48","name":null,"service_account":false,"status":"Pending"}}]}'
headers:
content-type:
- application/vnd.api+json
status:
code: 200
message: OK
- request:
body: '{"data":{"attributes":{"role":"admin"},"type":"team_memberships"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: PATCH
uri: https://api.datadoghq.com/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607/memberships/3330c2ed-ac5d-458e-875b-ffc85c436edc
response:
body:
string: '{"data":{"type":"team_memberships","id":"TeamMembership-38c0d1d3-69c0-4452-95a0-0115b22f2607-65393600","attributes":{"role":"admin","provisioned_by":null,"provisioned_by_id":"3ad549bf-eba0-11e9-a77a-0705486660d0"},"relationships":{"user":{"data":{"type":"users","id":"3330c2ed-ac5d-458e-875b-ffc85c436edc"}}}},"included":[{"type":"users","id":"3330c2ed-ac5d-458e-875b-ffc85c436edc","attributes":{"name":null,"handle":"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com","email":"test-update_a_user_s_membership_attributes_on_a_team_returns_ok_response-1770908386@datadoghq.com","icon":"https://secure.gravatar.com/avatar/7906350a0aeb9c3285de81609654b5df?s=48&d=retro","disabled":false,"service_account":false}}]}

'
headers:
content-type:
- application/json
status:
code: 200
message: OK
- request:
body: null
headers:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607/memberships/3330c2ed-ac5d-458e-875b-ffc85c436edc
response:
body:
string: ''
headers: {}
status:
code: 204
message: No Content
- request:
body: null
headers:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/users/3330c2ed-ac5d-458e-875b-ffc85c436edc
response:
body:
string: ''
headers: {}
status:
code: 204
message: No Content
- request:
body: null
headers:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/team/38c0d1d3-69c0-4452-95a0-0115b22f2607
response:
body:
string: ''
headers: {}
status:
code: 204
message: No Content
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2026-02-12T15:00:05.356Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
interactions:
- request:
body: '{"data":{"attributes":{"handle":"test-handle-ff2b53b6514455c7","name":"test-name-ff2b53b6514455c7"},"type":"team"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v2/team
response:
body:
string: '{"data":{"id":"9c2a3be7-8a43-4f37-bc3d-88248875f867","type":"team","attributes":{"avatar":null,"banner":3,"created_at":"2026-02-12T15:00:05.867555+00:00","description":null,"handle":"test-handle-ff2b53b6514455c7","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2026-02-12T15:00:05.867555+00:00","name":"test-name-ff2b53b6514455c7","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867/permission-settings"}}}}}'
headers:
content-type:
- application/vnd.api+json
status:
code: 201
message: Created
- request:
body: '{"data":{"attributes":{"email":"Test-Update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_API_error_response_respons-1770908405@datadoghq.com","title":"user
title"},"type":"users"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v2/users
response:
body:
string: '{"data":{"type":"users","id":"eed29272-352e-4bf8-ab48-ad007a1f7179","attributes":{"name":null,"handle":"test-update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_api_error_response_respons-1770908405@datadoghq.com","created_at":"2026-02-12T15:00:06.429855+00:00","modified_at":"2026-02-12T15:00:06.429855+00:00","email":"test-update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_api_error_response_respons-1770908405@datadoghq.com","icon":"https://secure.gravatar.com/avatar/1a5d1f711a7790783032ea8e4653d473?s=48&d=retro","title":"user
title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}}

'
headers:
content-type:
- application/json
status:
code: 201
message: Created
- request:
body: '{"data":{"attributes":{"role":"admin"},"relationships":{"user":{"data":{"id":"eed29272-352e-4bf8-ab48-ad007a1f7179","type":"users"}}},"type":"team_memberships"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867/memberships
response:
body:
string: '{"data":{"id":"TeamMembership-9c2a3be7-8a43-4f37-bc3d-88248875f867-65393607","type":"team_memberships","attributes":{"provisioned_by":null,"provisioned_by_id":"3ad549bf-eba0-11e9-a77a-0705486660d0","role":"admin"},"relationships":{"user":{"data":{"id":"eed29272-352e-4bf8-ab48-ad007a1f7179","type":"users"}}}},"included":[{"id":"eed29272-352e-4bf8-ab48-ad007a1f7179","type":"users","attributes":{"disabled":false,"email":"test-update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_api_error_response_respons-1770908405@datadoghq.com","handle":"test-update_a_user_s_membership_attributes_on_a_team_with_invalid_role_returns_api_error_response_respons-1770908405@datadoghq.com","icon":"https://secure.gravatar.com/avatar/1a5d1f711a7790783032ea8e4653d473?d=retro\u0026s=48","name":null,"service_account":false,"status":"Pending"}}]}'
headers:
content-type:
- application/vnd.api+json
status:
code: 200
message: OK
- request:
body: '{"data":{"attributes":{"role":"member"},"type":"team_memberships"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: PATCH
uri: https://api.datadoghq.com/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867/memberships/eed29272-352e-4bf8-ab48-ad007a1f7179
response:
body:
string: '{"errors":["{''errors'': [{''detail'': ''Not a valid choice.'', ''source'':
{''pointer'': ''/data/attributes/role''}}]}"]}'
headers:
content-type:
- application/json
status:
code: 400
message: Bad Request
- request:
body: null
headers:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867/memberships/eed29272-352e-4bf8-ab48-ad007a1f7179
response:
body:
string: ''
headers: {}
status:
code: 204
message: No Content
- request:
body: null
headers:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/users/eed29272-352e-4bf8-ab48-ad007a1f7179
response:
body:
string: ''
headers: {}
status:
code: 204
message: No Content
- request:
body: null
headers:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/team/9c2a3be7-8a43-4f37-bc3d-88248875f867
response:
body:
string: ''
headers: {}
status:
code: 204
message: No Content
version: 1
4 changes: 4 additions & 0 deletions tests/v2/features/given.json
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,10 @@
},
{
"parameters": [
{
"name": "team_id",
"source": "dd_team.data.id"
},
{
"name": "body",
"value": "{\n \"data\": {\n \"attributes\": {\n \"role\": \"admin\"\n },\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"{{user.data.id}}\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"team_memberships\"\n }\n}"
Expand Down
Loading
Loading