AppMage

Static Site Endpoints

This endpoint group provides methods for interacting with static site features, such as newsletter subscriptions and contact form submissions. These endpoints are designed for public access from static frontends.

Endpoints

POST /api/rpc (Method: StaticSiteRpc.subscribe)

  • Description: Subscribes a user to a newsletter by saving their details.

  • Request Body:

    {
      "method": "StaticSiteRpc.subscribe",
      "params": {
        "name": "John Doe",
        "email": "[email protected]",
        "phoneNumber": "+15551234567",
        "whatsappConsent": true
      }
    }
  • Parameters:

    Name Type Required Description
    name String No The name of the subscriber.
    email String Yes The email address of the subscriber. Must be a valid email format.
    phoneNumber String No The phone number of the subscriber.
    whatsappConsent Boolean No Indicates if the user consents to receive WhatsApp messages. Defaults to false.
  • Response:

    {
      "success": true,
      "data": {
        "message": "You have been successfully subscribed!"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "StaticSiteRpc.subscribe",
        "params": {
          "name": "John Doe",
          "email": "[email protected]",
          "phoneNumber": "+15551234567",
          "whatsappConsent": true
        }
      }'

POST /api/rpc (Method: StaticSiteRpc.submitContactForm)

  • Description: Handles submissions from a contact form on the static site.

  • Request Body:

    {
      "method": "StaticSiteRpc.submitContactForm",
      "params": {
        "name": "Jane Doe",
        "email": "[email protected]",
        "subject": "Inquiry about services",
        "message": "I would like to know more about your offerings."
      }
    }
  • Parameters:

    Name Type Required Description
    name String Yes The name of the person submitting the form.
    email String Yes A valid email address for contact.
    subject String Yes The subject of the contact message.
    message String Yes The body of the contact message.
  • Response:

    {
      "success": true,
      "data": {
        "message": "Thank you for your message! We will get back to you shortly."
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "StaticSiteRpc.submitContactForm",
        "params": {
          "name": "Jane Doe",
          "email": "[email protected]",
          "subject": "Inquiry about services",
          "message": "I would like to know more about your offerings."
        }
      }'