Data Management API Reference

This section provides a comprehensive reference to the APIs for managing data within the MSDN platform. You can perform operations such as creating, reading, updating, and deleting data entities, as well as querying and filtering data.

Data Entity Operations

POST /api/v1/data/{entityType}

Creates a new data entity of the specified type.

Request Body:

{
  "field1": "value1",
  "field2": 123,
  // ... other fields
}

Parameters:

Name Type Description Required
entityType string The type of data entity to create (e.g., 'users', 'products', 'orders'). Path
field1 string The value for the 'field1' property. No
field2 integer The value for the 'field2' property. No

Response:

{
  "id": "unique-entity-id",
  "createdAt": "2023-10-27T10:00:00Z",
  // ... other created entity properties
}

GET /api/v1/data/{entityType}/{id}

Retrieves a specific data entity by its ID.

Parameters:

Name Type Description Required
entityType string The type of data entity. Path
id string The unique identifier of the entity. Path

Response:

{
  "id": "entity-id",
  "field1": "value1",
  "field2": 123,
  "updatedAt": "2023-10-27T10:05:00Z"
  // ... other entity properties
}

PUT /api/v1/data/{entityType}/{id}

Updates an existing data entity by its ID.

Request Body:

{
  "field1": "new-value",
  // ... fields to update
}

Parameters:

Name Type Description Required
entityType string The type of data entity. Path
id string The unique identifier of the entity. Path

Response:

{
  "id": "entity-id",
  "field1": "new-value",
  "updatedAt": "2023-10-27T10:10:00Z"
  // ... updated entity properties
}

DELETE /api/v1/data/{entityType}/{id}

Deletes a data entity by its ID.

Parameters:

Name Type Description Required
entityType string The type of data entity. Path
id string The unique identifier of the entity. Path

Response:

{
  "message": "Entity deleted successfully."
}

Note: Ensure you have the necessary permissions before performing delete operations, as they are irreversible.

Data Querying and Filtering

GET /api/v1/data/{entityType}

Retrieves a collection of data entities, with support for filtering, sorting, and pagination.

Query Parameters:

Name Type Description Example
filter string Filter results based on field values. Supports logical operators AND/OR and comparison operators (=, !=, >, <, >=, <=). Example: field1=value1 AND field2>100 status=active&created_at>=2023-01-01
sort string Sort results by one or more fields. Use '-' prefix for descending order. Example: -createdAt,name name,-updated_at
limit integer The maximum number of results to return. 20
offset integer The number of results to skip. 40

Response:

{
  "total": 150,
  "data": [
    {
      "id": "entity-id-1",
      "field1": "valueA",
      "createdAt": "2023-10-26T15:00:00Z"
    },
    {
      "id": "entity-id-2",
      "field1": "valueB",
      "createdAt": "2023-10-25T11:30:00Z"
    }
    // ... more entities
  ]
}

Tip: Use the filter parameter to efficiently narrow down your search results. For complex filtering, consider chaining multiple filter criteria.

Example Usage: Fetching active users created after January 1st, 2023, sorted by name

GET /api/v1/data/users?filter=status=active&created_at>=2023-01-01&sort=name

Bulk Operations

POST /api/v1/data/bulk/{entityType}

Performs bulk operations (create, update, delete) on multiple entities in a single request.

Request Body:

{
  "operations": [
    {
      "method": "POST", // or "PUT", "DELETE"
      "data": { "field1": "value1" } // for POST/PUT
      // "id": "entity-id-to-delete" for DELETE
    },
    {
      "method": "PUT",
      "id": "existing-entity-id",
      "data": { "field2": 456 }
    }
  ]
}

Parameters:

Name Type Description Required
entityType string The type of data entity. Path

Response:

{
  "results": [
    { "status": "success", "id": "new-entity-id-1" },
    { "status": "success", "id": "existing-entity-id" },
    { "status": "success", "id": "entity-id-to-delete" }
    // ...
  ]
}

Warning: Bulk delete operations cannot be undone. Proceed with caution.