Initial commit: Open sourcing all of the Maple Open Technologies code.
This commit is contained in:
commit
755d54a99d
2010 changed files with 448675 additions and 0 deletions
88
cloud/maplepress-backend/docs/API/create-tenant.md
Normal file
88
cloud/maplepress-backend/docs/API/create-tenant.md
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
# Create Tenant
|
||||
|
||||
**POST /api/v1/tenants**
|
||||
|
||||
Create a new tenant (organization).
|
||||
|
||||
**Authentication**: Required (JWT Bearer token)
|
||||
|
||||
**Headers**:
|
||||
- `Content-Type: application/json`
|
||||
- `Authorization: JWT {access_token}`
|
||||
|
||||
**Request Body**:
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| name | string | Yes | Tenant/organization name |
|
||||
| slug | string | Yes | URL-friendly tenant identifier |
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8000/api/v1/tenants \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
|
||||
-d '{
|
||||
"name": "TechStart Inc",
|
||||
"slug": "techstart"
|
||||
}'
|
||||
```
|
||||
|
||||
**Example Response** (201 Created):
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "850e8400-e29b-41d4-a716-446655440000",
|
||||
"name": "TechStart Inc",
|
||||
"slug": "techstart",
|
||||
"status": "active",
|
||||
"created_at": "2024-10-24T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
**Error Responses**:
|
||||
|
||||
This endpoint returns errors in **RFC 9457 (Problem Details for HTTP APIs)** format.
|
||||
|
||||
**Content-Type**: `application/problem+json`
|
||||
|
||||
**400 Bad Request** - Invalid input:
|
||||
```json
|
||||
{
|
||||
"type": "about:blank",
|
||||
"title": "Bad Request",
|
||||
"status": 400,
|
||||
"detail": "Invalid request body format"
|
||||
}
|
||||
```
|
||||
|
||||
**401 Unauthorized** - Missing or invalid JWT token:
|
||||
```json
|
||||
{
|
||||
"type": "about:blank",
|
||||
"title": "Unauthorized",
|
||||
"status": 401,
|
||||
"detail": "Authentication required"
|
||||
}
|
||||
```
|
||||
|
||||
**409 Conflict** - Tenant slug already exists:
|
||||
```json
|
||||
{
|
||||
"type": "about:blank",
|
||||
"title": "Conflict",
|
||||
"status": 409,
|
||||
"detail": "Tenant slug already exists"
|
||||
}
|
||||
```
|
||||
|
||||
**500 Internal Server Error**:
|
||||
```json
|
||||
{
|
||||
"type": "about:blank",
|
||||
"title": "Internal Server Error",
|
||||
"status": 500,
|
||||
"detail": "Failed to create tenant"
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue