This document outlines the API endpoints for managing user profiles within the MSDN platform. You can retrieve, create, update, and delete user profile information using these RESTful endpoints.

Authentication

All requests to the User Profiles API must be authenticated. Please refer to the Authentication section for details on how to obtain and use API keys or OAuth tokens.

Endpoints

GET /api/v1/users/{userId}/profile

Retrieve a User Profile

Fetches the profile information for a specific user.

Path Parameters

Name Type Description Required
userId string The unique identifier of the user whose profile is to be retrieved. Yes

Response (Success)

200 OK
{
    "userId": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
    "firstName": "Jane",
    "lastName": "Doe",
    "email": "jane.doe@example.com",
    "displayName": "JaneDoe",
    "bio": "Enthusiastic developer and lifelong learner.",
    "avatarUrl": "https://example.com/avatars/janedoe.png",
    "createdAt": "2023-01-15T10:30:00Z",
    "updatedAt": "2023-10-26T14:45:10Z"
}

Response (Error)

404 Not Found
{
    "error": "User not found",
    "message": "The requested user profile could not be found."
}
401 Unauthorized
{
    "error": "Authentication required",
    "message": "Valid API credentials are required to access this resource."
}
POST /api/v1/users/{userId}/profile

Create a User Profile

Creates a new profile for a specified user. This endpoint is typically used when a new user account is provisioned.

Path Parameters

Name Type Description Required
userId string The unique identifier for the new user. Yes

Request Body

The request body should contain the initial profile data in JSON format.

{
    "firstName": "John",
    "lastName": "Smith",
    "email": "john.smith@example.com",
    "displayName": "JohnSmith"
}

Response (Success)

201 Created
{
    "userId": "b9c8d7e6-f5a4-3210-fedc-ba9876543210",
    "firstName": "John",
    "lastName": "Smith",
    "email": "john.smith@example.com",
    "displayName": "JohnSmith",
    "bio": null,
    "avatarUrl": null,
    "createdAt": "2023-10-26T15:00:00Z",
    "updatedAt": "2023-10-26T15:00:00Z"
}

Response (Error)

400 Bad Request
{
    "error": "Invalid input",
    "message": "Missing required fields (e.g., firstName, email)."
}
409 Conflict
{
    "error": "Profile already exists",
    "message": "A profile for this user ID already exists."
}
PUT /api/v1/users/{userId}/profile

Update a User Profile

Updates an existing user profile. All fields provided in the request body will be updated.

Path Parameters

Name Type Description Required
userId string The unique identifier of the user whose profile is to be updated. Yes

Request Body

The request body should contain the updated profile data in JSON format. Fields not included will remain unchanged.

{
    "firstName": "Jane",
    "lastName": "Doe-Smith",
    "bio": "Passionate about open source and community building.",
    "avatarUrl": "https://example.com/avatars/janesmith_new.png"
}

Response (Success)

200 OK
{
    "userId": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
    "firstName": "Jane",
    "lastName": "Doe-Smith",
    "email": "jane.doe@example.com",
    "displayName": "JaneDoe",
    "bio": "Passionate about open source and community building.",
    "avatarUrl": "https://example.com/avatars/janesmith_new.png",
    "createdAt": "2023-01-15T10:30:00Z",
    "updatedAt": "2023-10-26T16:00:00Z"
}

Response (Error)

404 Not Found
{
    "error": "User not found",
    "message": "The user profile to update could not be found."
}
400 Bad Request
{
    "error": "Invalid input",
    "message": "Email address format is invalid."
}
DELETE /api/v1/users/{userId}/profile

Delete a User Profile

Deletes the profile information for a specific user. This operation is irreversible.

Path Parameters

Name Type Description Required
userId string The unique identifier of the user whose profile is to be deleted. Yes

Response (Success)

204 No Content

The user profile has been successfully deleted.

Response (Error)

404 Not Found
{
    "error": "User not found",
    "message": "The user profile to delete could not be found."
}