Net API - Core Endpoints

Introduction to Core API

The Core API provides fundamental functionalities for interacting with the Net platform. This section details the primary endpoints for managing resources, retrieving system information, and performing basic operations.

List Resources

GET /net/api/core/resources

Retrieves a paginated list of all available resources within the system. This endpoint is useful for discovering what entities can be managed or accessed.

Parameters:

Name Type Description Required
page Integer The page number to retrieve (defaults to 1). No
limit Integer The maximum number of items to return per page (defaults to 20, max 100). No
type String Filters resources by their type (e.g., 'user', 'project', 'file'). No

Example Request:

GET /net/api/core/resources?page=2&limit=10&type=user HTTP/1.1
Host: api.example.com
Authorization: Bearer YOUR_ACCESS_TOKEN

Example Response (Success):

HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": [
    {
      "id": "res_abc123",
      "type": "user",
      "name": "Alice Smith",
      "created_at": "2023-10-27T10:00:00Z"
    },
    {
      "id": "res_def456",
      "type": "project",
      "name": "Project Phoenix",
      "created_at": "2023-10-26T15:30:00Z"
    }
  ],
  "meta": {
    "currentPage": 2,
    "totalPages": 5,
    "totalItems": 100,
    "itemsPerPage": 10
  }
}

Get System Health

GET /net/api/core/health

Checks the operational status of the Net API. This endpoint is typically used for monitoring and diagnostics.

Example Request:

GET /net/api/core/health HTTP/1.1
Host: api.example.com

Example Response (Healthy):

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "healthy",
  "timestamp": "2023-10-27T11:00:00Z",
  "checks": {
    "database": "ok",
    "cache": "ok",
    "service_a": "ok"
  }
}

Example Response (Degraded):

HTTP/1.1 503 Service Unavailable
Content-Type: application/json

{
  "status": "degraded",
  "timestamp": "2023-10-27T11:05:00Z",
  "checks": {
    "database": "ok",
    "cache": "warning",
    "service_a": "ok"
  }
}

Create Resource

POST /net/api/core/resources

Creates a new resource of a specified type. The type and properties of the resource are defined in the request body.

Request Body Schema:

{
  "type": "string", // Required. The type of resource to create (e.g., "user", "group")
  "properties": {
    // Key-value pairs representing the attributes of the resource
    // e.g., "name": "New User", "email": "newuser@example.com"
  }
}

Example Request:

POST /net/api/core/resources HTTP/1.1
Host: api.example.com
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN

{
  "type": "user",
  "properties": {
    "name": "Jane Doe",
    "email": "jane.doe@example.com",
    "role": "editor"
  }
}

Example Response (Success):

HTTP/1.1 201 Created
Content-Type: application/json
Location: /net/api/core/resources/res_ghi789

{
  "id": "res_ghi789",
  "type": "user",
  "name": "Jane Doe",
  "email": "jane.doe@example.com",
  "role": "editor",
  "created_at": "2023-10-27T12:00:00Z"
}