# api2.app96.cc PHP API

This folder is a deployable PHP API template for `api2.app96.cc`.

## 1) Setup

1. Import `bootstrap.sql` into your MySQL server.
2. Edit `config.php` with production DB credentials.
3. Upload this folder to your web root (or map to `api2.app96.cc` vhost).

## 2) Endpoints

- `GET /api/profile.php?deviceId=...`
  - Read profile by device.
  - If no record exists, returns default account `daywin888`.

- `POST /api/profile.php`
  - Save profile.
  - JSON body:
    - `deviceId` (required)
    - `account` (optional, default `daywin888`)
    - `displayName` (optional)

- `POST /api/contacts.php`
  - Save contacts payload.
  - JSON body:
    - `deviceId` (required)
    - `platform` (optional)
    - `contacts` (array, required)

- `POST /api/events.php`
  - Save calendar events.
  - JSON body:
    - `deviceId` (required)
    - `title` (required)
    - `notes`, `startAt`, `endAt` (optional)

## 3) Quick test (PowerShell)

```powershell
Invoke-RestMethod -Method Get "https://api2.app96.cc/api/profile.php?deviceId=test-device"
```
