Add group member
Add group member
client.Zones.Groups.Members.Add(ctx, groupID, params) (*GroupMember, error)
POST/zones/{zoneId}/groups/{groupId}/members
Adds a user to a group managed in Keycard. Membership of externally synced groups is not managed manually.
Parameters
groupID string
Returns
Add group member
package main
import (
"context"
"fmt"
"github.com/keycardai/keycard-go"
"github.com/keycardai/keycard-go/option"
)
func main() {
client := keycard.NewClient(
option.WithAPIKey("My API Key"),
)
groupMember, err := client.Zones.Groups.Members.Add(
context.TODO(),
"groupId",
keycard.ZoneGroupMemberAddParams{
ZoneID: "zoneId",
GroupMemberCreate: keycard.GroupMemberCreateParam{
UserID: "user_id",
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", groupMember.UserID)
}
{
"created_at": "2019-12-27T18:11:19.117Z",
"user_id": "user_id",
"user": {
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"email": "dev@stainless.com",
"email_verified": true,
"identifier": "identifier",
"organization_id": "organization_id",
"status": "active",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"authenticated_at": "authenticated_at",
"credentials": [
{
"created_at": "2019-12-27T18:11:19.117Z",
"provider_id": "provider_id",
"type": "federation",
"updated_at": "2019-12-27T18:11:19.117Z",
"issuer": "issuer",
"provider": {
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"identifier": "x",
"name": "x",
"organization_id": "organization_id",
"owner_type": "platform",
"slug": "slug",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"client_id": "client_id",
"client_secret_set": true,
"description": "description",
"metadata": {
"icon_url": "https://example.com"
},
"protocols": {
"oauth2": {
"issuer": "https://example.com",
"authorization_endpoint": "https://example.com",
"authorization_parameters": {
"foo": "string"
},
"authorization_resource_enabled": true,
"authorization_resource_parameter": "authorization_resource_parameter",
"code_challenge_methods_supported": [
"string"
],
"jwks_uri": "https://example.com",
"registration_endpoint": "https://example.com",
"scope_parameter": "scope_parameter",
"scope_separator": "scope_separator",
"scopes_supported": [
"string"
],
"token_endpoint": "https://example.com",
"token_response_access_token_pointer": "token_response_access_token_pointer"
},
"openid": {
"external_id_claim": "external_id_claim",
"scopes": [
"string"
],
"single_logout_enabled": true,
"user_identifier_claim": "user_identifier_claim",
"userinfo_endpoint": "https://example.com"
}
},
"type": "external"
},
"subject": "subject"
}
],
"grant_count": 0,
"groups": [
{
"id": "id",
"identifier": "identifier",
"name": "name"
}
],
"issuer": "issuer",
"provider_id": "provider_id",
"role_assignments": [
{
"role_id": "role_id",
"role_identifier": "role_identifier",
"role_owner_type": "platform",
"scope": {
"id": "id",
"type": "type"
},
"source": "user",
"group_id": "group_id"
}
],
"session_count": 0,
"subject": "subject"
}
}Returns Examples
{
"created_at": "2019-12-27T18:11:19.117Z",
"user_id": "user_id",
"user": {
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"email": "dev@stainless.com",
"email_verified": true,
"identifier": "identifier",
"organization_id": "organization_id",
"status": "active",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"authenticated_at": "authenticated_at",
"credentials": [
{
"created_at": "2019-12-27T18:11:19.117Z",
"provider_id": "provider_id",
"type": "federation",
"updated_at": "2019-12-27T18:11:19.117Z",
"issuer": "issuer",
"provider": {
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"identifier": "x",
"name": "x",
"organization_id": "organization_id",
"owner_type": "platform",
"slug": "slug",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"client_id": "client_id",
"client_secret_set": true,
"description": "description",
"metadata": {
"icon_url": "https://example.com"
},
"protocols": {
"oauth2": {
"issuer": "https://example.com",
"authorization_endpoint": "https://example.com",
"authorization_parameters": {
"foo": "string"
},
"authorization_resource_enabled": true,
"authorization_resource_parameter": "authorization_resource_parameter",
"code_challenge_methods_supported": [
"string"
],
"jwks_uri": "https://example.com",
"registration_endpoint": "https://example.com",
"scope_parameter": "scope_parameter",
"scope_separator": "scope_separator",
"scopes_supported": [
"string"
],
"token_endpoint": "https://example.com",
"token_response_access_token_pointer": "token_response_access_token_pointer"
},
"openid": {
"external_id_claim": "external_id_claim",
"scopes": [
"string"
],
"single_logout_enabled": true,
"user_identifier_claim": "user_identifier_claim",
"userinfo_endpoint": "https://example.com"
}
},
"type": "external"
},
"subject": "subject"
}
],
"grant_count": 0,
"groups": [
{
"id": "id",
"identifier": "identifier",
"name": "name"
}
],
"issuer": "issuer",
"provider_id": "provider_id",
"role_assignments": [
{
"role_id": "role_id",
"role_identifier": "role_identifier",
"role_owner_type": "platform",
"scope": {
"id": "id",
"type": "type"
},
"source": "user",
"group_id": "group_id"
}
],
"session_count": 0,
"subject": "subject"
}
}