- Add authentication scripts with SubtleCrypto password encryption - Add sourcemap extraction pipeline (update-urls, download-sourcemaps, extract-sources) - Add Playwright API interception script for monetization endpoints - Document two-step auth flow with JWT tokens and dual cookies - Move extracted source from root to anyclip/ directory - Add project configuration (.env.example, .gitignore, CLAUDE.md)
153 lines
2.4 KiB
Markdown
153 lines
2.4 KiB
Markdown
# AnyClip Monetization API Documentation
|
|
|
|
> **Note:** This document should be populated after running the API interception script.
|
|
> Run `bun scripts/intercept-monetization.ts` and interact with the monetization page to capture API endpoints.
|
|
|
|
## Overview
|
|
|
|
The monetization analytics page uses several API endpoints to fetch and display revenue data, filtering options, and export capabilities.
|
|
|
|
## Expected Endpoints
|
|
|
|
Based on component analysis, the following endpoints should be captured:
|
|
|
|
### Metrics Totals
|
|
|
|
Fetches aggregate metrics for the dashboard cards.
|
|
|
|
```
|
|
Endpoint: TBD (populate from captured-apis.json)
|
|
Method: POST/GET
|
|
```
|
|
|
|
**Request:**
|
|
```json
|
|
{
|
|
// To be documented after capture
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
// To be documented after capture
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
### Chart Data (Time Series)
|
|
|
|
Fetches time-series data for the monetization charts.
|
|
|
|
```
|
|
Endpoint: TBD
|
|
Method: POST/GET
|
|
```
|
|
|
|
**Request:**
|
|
```json
|
|
{
|
|
// To be documented after capture
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
// To be documented after capture
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
### Filter Options
|
|
|
|
#### Demand Sources
|
|
|
|
```
|
|
Endpoint: TBD
|
|
Method: GET
|
|
```
|
|
|
|
#### Players
|
|
|
|
```
|
|
Endpoint: TBD
|
|
Method: GET
|
|
```
|
|
|
|
#### Domains
|
|
|
|
```
|
|
Endpoint: TBD
|
|
Method: GET
|
|
```
|
|
|
|
#### Countries
|
|
|
|
```
|
|
Endpoint: TBD
|
|
Method: GET
|
|
```
|
|
|
|
---
|
|
|
|
### CSV Export
|
|
|
|
Endpoint for downloading monetization data as CSV.
|
|
|
|
```
|
|
Endpoint: TBD
|
|
Method: GET/POST
|
|
```
|
|
|
|
---
|
|
|
|
## How to Update This Document
|
|
|
|
1. Run the interception script:
|
|
```bash
|
|
bun scripts/intercept-monetization.ts
|
|
```
|
|
|
|
2. Log in to AnyClip in the browser window that opens
|
|
|
|
3. Once logged in, the script navigates to the monetization page
|
|
|
|
4. Interact with the page:
|
|
- Change date ranges
|
|
- Apply different filters (demand sources, players, domains, countries)
|
|
- Click export buttons
|
|
- Switch between chart views
|
|
|
|
5. Press `Ctrl+C` to stop capturing and save data
|
|
|
|
6. Review `captured-apis.json` in the project root
|
|
|
|
7. Update this document with the captured endpoint details
|
|
|
|
## Captured Data Format
|
|
|
|
The `captured-apis.json` file contains:
|
|
|
|
```json
|
|
{
|
|
"capturedAt": "ISO timestamp",
|
|
"totalRequests": 42,
|
|
"requests": [
|
|
{
|
|
"timestamp": "ISO timestamp",
|
|
"url": "full URL",
|
|
"method": "GET/POST",
|
|
"headers": { ... },
|
|
"requestBody": "JSON string or null",
|
|
"responseStatus": 200,
|
|
"responseHeaders": { ... },
|
|
"responseBody": "JSON string",
|
|
"duration": 123
|
|
}
|
|
]
|
|
}
|
|
```
|