Newsletter Subscriptions
Manage email newsletter subscriptions.
Create Newsletter Subscription
/api/newsletter_subscriptions
Creates a new newsletter subscription.
Request Body
Email address to subscribe
Page URL where the subscription was initiated
Whether the subscription is active. Default: true
Timestamp when subscription was created (ISO 8601 format)
Timestamp when user unsubscribed (ISO 8601 format). null if still subscribed
Response
Unique identifier for the subscription
Unsubscribe timestamp (null if active)
Example Request
curl -X POST http://localhost:8080/api/newsletter_subscriptions \
-H "Content-Type: application/json" \
-d '{
"email": "laura.garcia@example.com",
"sourcePage": "https://kinconecta.com/",
"isActive": true
}'
Example Response
{
"subscriptionId": 5623,
"email": "laura.garcia@example.com",
"sourcePage": "https://kinconecta.com/",
"isActive": true,
"createdAt": "2026-03-11T15:45:12",
"unsubscribedAt": null
}
Get All Newsletter Subscriptions
/api/newsletter_subscriptions
Retrieves all newsletter subscriptions.
Example Request
curl http://localhost:8080/api/newsletter_subscriptions
Example Response
[
{
"subscriptionId": 5623,
"email": "laura.garcia@example.com",
"sourcePage": "https://kinconecta.com/",
"isActive": true,
"createdAt": "2026-03-11T15:45:12",
"unsubscribedAt": null
},
{
"subscriptionId": 5622,
"email": "miguel.lopez@example.com",
"sourcePage": "https://kinconecta.com/tours",
"isActive": false,
"createdAt": "2026-03-10T12:30:00",
"unsubscribedAt": "2026-03-11T10:20:00"
}
]
Get Newsletter Subscription by ID
/api/newsletter_subscriptions/{id}
Retrieves a specific newsletter subscription by ID.
Path Parameters
Example Request
curl http://localhost:8080/api/newsletter_subscriptions/5623
Example Response
{
"subscriptionId": 5623,
"email": "laura.garcia@example.com",
"sourcePage": "https://kinconecta.com/",
"isActive": true,
"createdAt": "2026-03-11T15:45:12",
"unsubscribedAt": null
}
Update Newsletter Subscription
/api/newsletter_subscriptions/{id}
Updates a newsletter subscription (typically to unsubscribe).
Path Parameters
Request Body
Same fields as Create Newsletter Subscription.
Example Request
curl -X PUT http://localhost:8080/api/newsletter_subscriptions/5623 \
-H "Content-Type: application/json" \
-d '{
"email": "laura.garcia@example.com",
"sourcePage": "https://kinconecta.com/",
"isActive": false,
"createdAt": "2026-03-11T15:45:12",
"unsubscribedAt": "2026-03-11T16:30:00"
}'
Example Response
{
"subscriptionId": 5623,
"email": "laura.garcia@example.com",
"sourcePage": "https://kinconecta.com/",
"isActive": false,
"createdAt": "2026-03-11T15:45:12",
"unsubscribedAt": "2026-03-11T16:30:00"
}
Delete Newsletter Subscription
/api/newsletter_subscriptions/{id}
Permanently deletes a newsletter subscription.
Path Parameters
Example Request
curl -X DELETE http://localhost:8080/api/newsletter_subscriptions/5623
Common Use Cases
Subscribe to Newsletter
To subscribe a user to the newsletter:
curl -X POST http://localhost:8080/api/newsletter_subscriptions \
-H "Content-Type: application/json" \
-d '{
"email": "newuser@example.com",
"isActive": true
}'
Unsubscribe from Newsletter
To unsubscribe a user (set isActive to false and record timestamp):
curl -X PUT http://localhost:8080/api/newsletter_subscriptions/5623 \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"isActive": false,
"unsubscribedAt": "2026-03-11T16:30:00"
}'
Re-subscribe
To re-subscribe a previously unsubscribed user:
curl -X PUT http://localhost:8080/api/newsletter_subscriptions/5623 \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"isActive": true,
"unsubscribedAt": null
}'