Skip to content

Environment Endpoints

Environments represent managed hosting installations (Moodle, WordPress, custom) linked to ENV-class entitlements. Each environment tracks its platform, type, and operational status.

Base path: /wp-json/middag-account/v1/environments

Endpoints

MethodEndpointAuthScopeDescription
GET/environmentsJWT + OrgentitlementsList managed environments
GET/environments/{id}JWT + OrgentitlementsEnvironment details
GET/environments/{id}/ticketsJWT + OrgentitlementsService requests linked to env
POST/environments/{id}/ticketsJWT + OrgentitlementsCreate service request for env

GET /environments

List environments for the current organization.

Headers: X-Middag-Organization: {org_id}

Query filters:

ParameterTypeValues
statusstringprovisioning, active, maintenance, suspended, decommissioned
platformstringmoodle, wordpress, custom
environment_typestringproduction, staging, development, sandbox

Response (200):

json
{
    "success": true,
    "data": [
        {
            "id": 701,
            "name": "Acme Moodle Production",
            "status": "active",
            "platform": "moodle",
            "environment_type": "production",
            "url": "https://lms.example.com",
            "entitlement_id": 102,
            "entitlement_code": "ENV-2026040002",
            "organization_id": 42,
            "created_at": "2026-04-01T10:00:00Z"
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 20,
        "total": 1,
        "pages": 1
    }
}

GET /environments/:id

Full environment details.

Response fields: id, name, status, platform, environment_type, url, entitlement_id, entitlement_code, organization_id, metadata, created_at, updated_at.

GET /environments/:id/tickets

List service requests associated with this environment.

POST /environments/:id/tickets

Create a new service request for this environment. Clients can only create SRs for ENV-class entitlements.

Request:

json
{
    "title": "Upgrade Moodle to 4.5",
    "description": "Please upgrade our production instance to version 4.5.",
    "priority": "normal"
}

Response (201):

json
{
    "success": true,
    "data": {
        "id": 901,
        "number": "SR-20260001",
        "status": "open",
        "environment_id": 701
    },
    "message": "Service request created"
}

Environment Statuses

StatusDescription
provisioningBeing set up, not yet available
activeFully operational
maintenanceTemporarily under maintenance
suspendedAccess suspended (e.g., payment issue)
decommissionedPermanently shut down (terminal)