Skip to main content

GetUserProfileByUser

Retrieves a user profile by the associated user resource name.

Looks up and returns the user profile linked to a specific user ID. This is useful when you have a user resource and need to find their associated profile information.

Returns the UserProfile resource associated with the specified user.

Method Options​

Authorisation specification of the GetUserProfileByUser method.

TypeMETHOD_TYPE_READ
Access LevelMETHOD_ACCESS_LEVEL_AUTHORISED
Roles
  • ROLE_IAM_ADMIN
  • ROLE_IAM_VIEWER
  • ROLE_IAM_USER_PROFILE_ADMIN
  • ROLE_IAM_USER_PROFILE_VIEWER

Parameters​

Request and response parameter message overview:

Input: GetUserProfileByUserRequest Message​

FieldTypeRequiredDescription
User

string

True

The resource name of the user whose profile should be retrieved. Format: users/{ULIDv2}. This field is required.

Returns: UserProfile Message​

Code Examples​

Select supported SDK in the language of your choice for a full example of how to invoke the this method:

package main

import (
"context"
"log"

user_profilev1 "github.com/meshtrade/api/go/iam/user_profile/v1"
)

func main() {
ctx := context.Background()

// Default configuration is used and credentials come from MESH_API_CREDENTIALS
// environment variable or default discovery methods. Zero config required
// unless you want custom configuration.
service, err := user_profilev1.NewUserProfileService()
if err != nil {
log.Fatalf("Failed to create service: %v", err)
}
defer service.Close()

// Create request with the user resource name
// Replace the ULIDv2 with your actual user ID
request := &user_profilev1.GetUserProfileByUserRequest{
User: "users/01HQZXYZ9ABCDEFGHIJKLMNPQR",
}

// Call the GetUserProfileByUser method
userProfile, err := service.GetUserProfileByUser(ctx, request)
if err != nil {
log.Fatalf("GetUserProfileByUser failed: %v", err)
}

// Use the retrieved user profile
log.Printf("User Profile Retrieved:")
log.Printf(" Name: %s", userProfile.Name)
log.Printf(" First Name: %s", userProfile.FirstName)
log.Printf(" Last Name: %s", userProfile.LastName)
log.Printf(" User: %s", userProfile.User)
log.Printf(" Locale: %s", userProfile.Locale)
}

Advanced Configuration​

For advanced client configuration options (custom endpoints, TLS settings, timeouts), see the SDK Configuration Guide.

Other Methods​