/legacy-systems/counts - Replace the legacy systems counters

Add MCP server to your AI tool

Allow AI tools and LLMs to interact with the API documentation portal through MCP.

MCP server URL

https://api.my.nethesis.it/mcp

Standard setup for AI tools providing an mcp.json file

mcp.json
{
  "my.nethesis.it MCP server": {
    "url": "https://api.my.nethesis.it/mcp"
  }
}

Close
PUT /legacy-systems/counts

Stores how many systems each organization still has on the old my (legacy.my.nethesis.it). Called by the legacy sync with the owner API key, once per run; the values come back through legacy in /systems/totals and through legacy_systems_count in the organization stats and lists.

The payload is the COMPLETE picture and replaces the stored counters wholesale: an organization missing from it is an organization with no legacy systems left. That is what lets a counter fall back to zero as machines migrate, which an upsert-only endpoint could never do. An empty counts array is therefore legitimate and clears every counter.

Restricted to the Owner organization: the payload spans the whole fleet, so a partner writing it could inflate or erase any other partner's counter.

Transitional endpoint: it exists for as long as two portals answer for the same partner, and is removed at the legacy decommission.

application/json

Body Required

  • counts array[object] Required

    Not more than 5000 elements.

    Hide counts attributes Show counts attributes object
    • organization_id string Required

      Logto organization id of the reseller or distributor the legacy VAT maps to

    • total integer

      Systems still on the old my for that organization, excluding deleted and disabled ones

      Minimum value is 0.

Responses

  • 200 application/json

    Counters stored

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object
      Hide data attributes Show data attributes object
      • organizations integer

        Organizations written

      • systems integer

        Sum of the counters written

  • 400 application/json

    Bad request - validation error

    Hide response attributes Show response attributes object
    • code integer

      HTTP error code

    • message string

      Error message

    • data object
      Hide data attributes Show data attributes object
      • type string

        Type of error

        Values are validation_error or external_api_error.

      • errors array[object]
        Hide errors attributes Show errors attributes object
        • key string

          Field name that failed validation

        • message string

          Error code or message

        • value string

          Value that failed validation

      • details

        Additional error details

  • 401 application/json

    Unauthorized - invalid or missing token

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object | null
  • 403 application/json

    Forbidden - insufficient permissions

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object | null
  • 500 application/json

    Internal server error

    Hide response attributes Show response attributes object
    • code integer
    • message string
    • data object | null
PUT /legacy-systems/counts
curl \
 --request PUT 'https://api.your-domain.com/api/legacy-systems/counts' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{
  "counts": [
    {
      "organization_id": "obhdyclbfx4t",
      "total": 12
    }
  ]
}'
Request examples
{
  "counts": [
    {
      "organization_id": "obhdyclbfx4t",
      "total": 12
    }
  ]
}
Response examples (200)
{
  "code": 200,
  "message": "legacy systems counts stored",
  "data": {
    "organizations": 478,
    "systems": 16890
  }
}
Response examples (400)
{
  "code": 400,
  "message": "validation failed",
  "data": {
    "type": "validation_error",
    "errors": [
      {
        "key": "username",
        "message": "required",
        "value": "string"
      }
    ]
  }
}
Response examples (401)
{
  "code": 401,
  "message": "invalid token",
  "data": {}
}
Response examples (403)
{
  "code": 403,
  "message": "insufficient permissions",
  "data": {}
}
Response examples (500)
{
  "code": 500,
  "message": "internal server error",
  "data": {}
}