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
| Method | Endpoint | Auth | Scope | Description |
|---|---|---|---|---|
| GET | /environments | JWT + Org | entitlements | List managed environments |
| GET | /environments/{id} | JWT + Org | entitlements | Environment details |
| GET | /environments/{id}/tickets | JWT + Org | entitlements | Service requests linked to env |
| POST | /environments/{id}/tickets | JWT + Org | entitlements | Create service request for env |
GET /environments
List environments for the current organization.
Headers: X-Middag-Organization: {org_id}
Query filters:
| Parameter | Type | Values |
|---|---|---|
status | string | provisioning, active, maintenance, suspended, decommissioned |
platform | string | moodle, wordpress, custom |
environment_type | string | production, 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
| Status | Description |
|---|---|
provisioning | Being set up, not yet available |
active | Fully operational |
maintenance | Temporarily under maintenance |
suspended | Access suspended (e.g., payment issue) |
decommissioned | Permanently shut down (terminal) |