Skip to main content

GetUserProfilePictureUploadUrl

Retrieves a presigned upload URL for a user profile picture.

Generates a temporary upload URL that can be used to upload a profile picture image. The URL expires after a short duration and should be used immediately for uploading the image file.

Returns upload URL and expiration timestamp.

Method Options​

Authorisation specification of the GetUserProfilePictureUploadUrl method.

TypeMETHOD_TYPE_READ
Access LevelMETHOD_ACCESS_LEVEL_AUTHORISED
Roles
  • ROLE_IAM_ADMIN
  • ROLE_IAM_USER_PROFILE_ADMIN

Parameters​

Request and response parameter message overview:

Input: GetUserProfilePictureUploadUrlRequest Message​

FieldTypeRequiredDescription
Name

string

True

The resource name of the user profile to upload a picture for. Format: iam/user_profiles/{ULIDv2}. This field is required.

Returns: GetUserProfilePictureUploadUrlResponse Message​

FieldTypeDescription
UploadUrl

string

The presigned URL for uploading the profile picture. This URL should be used immediately with a PUT request to upload the image.

ExpiresAt

google.protobuf.Timestamp

The timestamp when the upload URL expires. After this time, the URL will no longer be valid for uploading.

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 profile resource name
// Replace the ULIDv2 with your actual user profile ID
request := &user_profilev1.GetUserProfilePictureUploadUrlRequest{
Name: "iam/user_profiles/01HQZXYZ9ABCDEFGHIJKLMNPQR",
}

// Call the GetUserProfilePictureUploadUrl method to get presigned upload URL
response, err := service.GetUserProfilePictureUploadUrl(ctx, request)
if err != nil {
log.Fatalf("GetUserProfilePictureUploadUrl failed: %v", err)
}

// Use the presigned URL to upload the profile picture
log.Printf("Upload URL: %s", response.UploadUrl)
log.Printf("Expires at: %s", response.ExpiresAt.AsTime())

// The URL can now be used with an HTTP PUT request to upload an image file
// Example: Use http.NewRequest("PUT", response.UploadUrl, imageReader)
}

Advanced Configuration​

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

Other Methods​