@@ -28,6 +28,8 @@ The API uses Spring Security with Basic Authentication. Some endpoints require a
2828| Update Entry (PUT/PATCH) | ` entry:edit ` |
2929| Delete Entry (DELETE) | ` entry:delete ` |
3030| Import Entries | ` entry:import ` |
31+ | Generate Summary (POST) | ` entry:edit ` |
32+ | S3 Presign URL (POST) | ` entry:edit ` |
3133
3234For tenant-specific endpoints, authorities are checked against the tenant context.
3335
@@ -438,6 +440,113 @@ GET /entries/template.md
438440- Content-Type: text/markdown
439441- Body: Markdown template with example content
440442
443+ ### 12. Generate Summary
444+
445+ Generate a summary for the given content using AI. ** Requires authentication.**
446+
447+ ** Request:**
448+
449+ ```
450+ POST /tenants/{tenantId}/summary
451+ Content-Type: application/json
452+ ```
453+
454+ ** Request Body:**
455+
456+ ``` json
457+ {
458+ "content" : " The blog content to summarize..."
459+ }
460+ ```
461+
462+ ** Response:**
463+
464+ - Status: 200 OK
465+ - Body:
466+
467+ ``` json
468+ {
469+ "summary" : " Generated summary text..."
470+ }
471+ ```
472+
473+ ** Error Responses:**
474+
475+ - Status: 400 Bad Request (when content is empty or blank)
476+
477+ ``` json
478+ {
479+ "detail" : " Content must not be empty" ,
480+ "status" : 400 ,
481+ "title" : " Bad Request"
482+ }
483+ ```
484+
485+ - Status: 401 Unauthorized (when not authenticated)
486+ - Status: 403 Forbidden (when user lacks ` entry:edit ` authority for the tenant)
487+
488+ ** Example:**
489+
490+ ``` bash
491+ curl -u editor:password -X POST http://localhost:8080/tenants/_/summary \
492+ -H " Content-Type: application/json" \
493+ -d ' {"content": "Sample blog content about Spring Boot"}'
494+ ```
495+
496+ ### 13. Get S3 Presigned URL
497+
498+ Generate a presigned URL for uploading files to S3. The uploaded files will be publicly accessible. ** Requires authentication.**
499+
500+ ** Request:**
501+
502+ ```
503+ POST /tenants/{tenantId}/s3/presign
504+ Content-Type: application/json
505+ ```
506+
507+ ** Request Body:**
508+
509+ ``` json
510+ {
511+ "fileName" : " image.png"
512+ }
513+ ```
514+
515+ ** Response:**
516+
517+ - Status: 200 OK
518+ - Body:
519+
520+ ``` json
521+ {
522+ "url" : " https://s3.example.com/{tenantId}/image.png?X-Amz-Algorithm=..."
523+ }
524+ ```
525+
526+ The returned URL can be used to upload a file via HTTP PUT request. After upload, the file is publicly accessible at the URL without query parameters.
527+
528+ ** Error Responses:**
529+
530+ - Status: 401 Unauthorized (when not authenticated)
531+ - Status: 403 Forbidden (when user lacks ` entry:edit ` authority for the tenant)
532+
533+ ** Example:**
534+
535+ ``` bash
536+ # Step 1: Get presigned URL
537+ curl -u editor:password -X POST http://localhost:8080/tenants/_/s3/presign \
538+ -H " Content-Type: application/json" \
539+ -d ' {"fileName": "my-image.png"}'
540+
541+ # Step 2: Upload file using presigned URL
542+ curl -X PUT " ${PRESIGNED_URL} " \
543+ -H " Content-Type: image/png" \
544+ --data-binary @my-image.png
545+
546+ # Step 3: Access file publicly (URL without query parameters)
547+ curl " https://s3.example.com/_/my-image.png"
548+ ```
549+
441550## Error Handling
442551
443552The API returns standard HTTP status codes and uses RFC 9457 Problem Details for error responses:
0 commit comments