API v1 Reference

This document provides a comprehensive reference for the v1 version of the MSDN API. It details the available endpoints, request parameters, response formats, and error codes.

Note: API v1 is still supported but is considered legacy. We recommend migrating to API v2 for new development.

Authentication

All API requests must be authenticated. We use OAuth 2.0 for authorization.

Obtaining an Access Token

To obtain an access token, make a POST request to the token endpoint:

POST /oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET

You will receive a JSON response containing your access_token.

{
  "access_token": "eyJhbGciOiJIUzI1NiIsIn...",
  "token_type": "Bearer",
  "expires_in": 3600
}

Authorizing Requests

Include your access token in the Authorization header of your requests:

Authorization: Bearer eyJhbGciOiJIUzI1NiIsIn...

Users

GET /v1/users

Retrieve a list of users.

Query Parameters

Name Type Description
limit Integer Maximum number of users to return (default: 20).
offset Integer Number of users to skip (default: 0).
status String Filter users by status (e.g., 'active', 'inactive').

Example Request

curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.msdn.com/v1/users?limit=10&status=active"

Example Response

{
  "data": [
    {
      "id": "usr_abc123",
      "name": "Alice Wonderland",
      "email": "alice@example.com",
      "status": "active",
      "created_at": "2023-10-26T10:00:00Z"
    },
    {
      "id": "usr_def456",
      "name": "Bob The Builder",
      "email": "bob@example.com",
      "status": "active",
      "created_at": "2023-10-25T14:30:00Z"
    }
  ],
  "total": 50,
  "limit": 10,
  "offset": 0
}

GET /v1/users/{id}

Retrieve a specific user by their ID.

URL Parameters

Name Type Description
id String The unique identifier of the user.

Example Request

curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.msdn.com/v1/users/usr_abc123"

Example Response

{
  "id": "usr_abc123",
  "name": "Alice Wonderland",
  "email": "alice@example.com",
  "status": "active",
  "created_at": "2023-10-26T10:00:00Z",
  "updated_at": "2023-10-26T11:00:00Z"
}

POST /v1/users

Create a new user.

Request Body

Name Type Required Description
name String Yes The full name of the user.
email String Yes The user's email address (must be unique).
status String No The initial status of the user (e.g., 'active', 'pending'). Defaults to 'pending'.

Example Request

curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{
      "name": "Charlie Chaplin",
      "email": "charlie@example.com"
    }' "https://api.msdn.com/v1/users"

Example Response (201 Created)

{
  "id": "usr_ghi789",
  "name": "Charlie Chaplin",
  "email": "charlie@example.com",
  "status": "pending",
  "created_at": "2023-10-27T09:00:00Z"
}

Products

Manage product information.

Orders

Handle order processing.

API v2 (Deprecated)

This section is for historical reference only. Please use API v2 for current development.

Deprecated: This API version is scheduled for deprecation.