Web API Documentation

Welcome to the official documentation for the MSDN Web APIs. This guide will help you integrate our services into your applications.

Introduction

The MSDN Web API provides a RESTful interface for accessing various MSDN resources. It allows developers to programmatically retrieve information, manage data, and interact with MSDN services.

All API requests should be made over HTTPS. The base URL for the API is:

https://api.msdn.microsoft.com/v1

Authentication

Authentication is required to access most of the MSDN Web API endpoints. We support multiple authentication methods:

API Keys

For simple integrations, you can use API keys. Obtain your API key from your MSDN developer portal. Include your API key in the request header as follows:

Authorization: ApiKey YOUR_API_KEY

OAuth 2.0

For more robust and secure integrations, we recommend using OAuth 2.0. This allows users to grant your application access to their data without sharing their credentials directly.

Follow the standard OAuth 2.0 authorization code grant flow. The authorization endpoint is:

https://login.microsoftonline.com/common/oauth2/v2.0/authorize

And the token endpoint is:

https://login.microsoftonline.com/common/oauth2/v2.0/token

Required scopes for API access include:

  • msdn.read: Read access to MSDN resources.
  • msdn.write: Write access to MSDN resources.

API Resources

The following resources are available through the MSDN Web API:

Users

Endpoints for retrieving and managing user information.

GET/users/{userId}

Retrieves detailed information about a specific user.

Parameters:
Name Type Description Required
userId string The unique identifier for the user. Yes
Example Response:
{
  "id": "usr_abc123",
  "username": "jane.doe",
  "email": "jane.doe@example.com",
  "displayName": "Jane Doe",
  "createdAt": "2023-10-27T10:00:00Z"
}
GET/users

Retrieves a list of users. Supports pagination and filtering.

Query Parameters:
Name Type Description Required
page integer The page number for results. Defaults to 1. No
limit integer The number of results per page. Defaults to 20. No
status string Filter by user status (e.g., 'active', 'inactive'). No
Example Response:
{
  "data": [
    {
      "id": "usr_abc123",
      "username": "jane.doe",
      "displayName": "Jane Doe"
    },
    {
      "id": "usr_def456",
      "username": "john.smith",
      "displayName": "John Smith"
    }
  ],
  "pagination": {
    "currentPage": 1,
    "totalPages": 5,
    "totalItems": 100,
    "itemsPerPage": 20
  }
}

Products

Endpoints for retrieving product information.

GET/products/{productId}

Retrieves details for a specific product.

Parameters:
Name Type Description Required
productId string The unique identifier for the product. Yes
Example Response:
{
  "id": "prod_xyz789",
  "name": "MSDN Professional Subscription",
  "description": "Full access to developer tools and resources.",
  "price": {
    "amount": 100.00,
    "currency": "USD"
  },
  "availability": "In Stock"
}

Orders

Endpoints for managing customer orders.

POST/orders

Creates a new order.

Request Body:
{
  "userId": "usr_abc123",
  "items": [
    {
      "productId": "prod_xyz789",
      "quantity": 1
    }
  ],
  "shippingAddress": {
    "street": "123 Main St",
    "city": "Anytown",
    "state": "CA",
    "zip": "90210",
    "country": "USA"
  }
}
Example Response:
{
  "orderId": "ord_lmn001",
  "status": "Pending",
  "createdAt": "2023-10-27T11:30:00Z"
}

Rate Limiting

To ensure fair usage and stability, the API enforces rate limits. You can find your current rate limit status in the response headers:

  • X-RateLimit-Limit: The maximum number of requests you can make in a given time window.
  • X-RateLimit-Remaining: The number of requests remaining in the current window.
  • X-RateLimit-Reset: The time (in Unix epoch seconds) when the limit will reset.

If you exceed the rate limit, you will receive a 429 Too Many Requests response.

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of a request. Error responses will include a JSON body with more details:

{
  "error": {
    "code": "invalid_request",
    "message": "The provided parameter 'userId' is missing or invalid.",
    "details": "Ensure 'userId' is a valid UUID."
  }
}

Common HTTP status codes include:

  • 200 OK: Request was successful.
  • 201 Created: Resource was successfully created.
  • 400 Bad Request: The request was malformed or invalid.
  • 401 Unauthorized: Authentication credentials were not provided or are invalid.
  • 403 Forbidden: You do not have permission to access this resource.
  • 404 Not Found: The requested resource could not be found.
  • 429 Too Many Requests: You have exceeded your rate limit.
  • 500 Internal Server Error: An unexpected error occurred on our server.

Versioning

The MSDN Web API uses URL-based versioning. The current stable version is v1. New versions will be introduced to provide new features or make breaking changes. We strive to maintain backward compatibility where possible.

You can specify the version in the URL path, e.g., /v1/users.