Endpoint #
POST /wp-json/rtcl/v1/store/email-owner
Description #
Send an email message to the owner of a specific store. The sender can provide their name, email, phone, and message content
Headers Required #
| Header | Value | Description |
|---|---|---|
Authorization | Bearer {access_token} | Required. User must be authenticated. |
Content-Type | application/json | Required. Request body must be JSON. |
Request Body Parameters #
| Parameter | Type | Required | Description |
|---|---|---|---|
store_id | integer | ✅ Yes | The ID of the store you want to email. |
name | string | No | Sender’s name. Defaults to the logged-in user’s display name if not provided. |
email | string | No | Sender’s email. Defaults to logged-in user’s email if not provided. |
phone | string | No | Sender’s phone number. |
message | string | Yes | The message content to send to the store owner. |
Example Request Body #
{
"store_id": 101,
"name": "Jane Doe",
"email": "jane@example.com",
"phone": "0123456789",
"message": "Hello, I am interested in your store items. Please contact me."
}
Example cURL Request #
curl -X POST "https://example.com/wp-json/rtcl/v1/store/email-owner" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"store_id": 101,
"name": "Jane Doe",
"email": "jane@example.com",
"phone": "0123456789",
"message": "Hello, I am interested in your store items. Please contact me."
}
Successful Response #
{
"status": "success",
"message": "Email has been successfully sent to the store owner."
}
Error Responses #
1. Store Not Found #
{
"status": "error",
"error": "BADREQUEST",
"code": "400",
"error_message": "Store not found."
}
2. User Not Logged In / Unauthorized #
{
"status": "error",
"error": "FORBIDDEN",
"code": "403",
"error_message": "You are not logged in."
}
3. Required Field Missing (message) #
{
"status": "error",
"error": "INVALID",
"code": "422",
"error_message": "Message field is required."
}
4. Invalid Parameter Type (e.g., store_id not integer) #
{
"status": "error",
"error": "INVALID_PARAM",
"code": "400",
"error_message": "store_id must be an integer."
}
5. REST API Disabled #
{
"code": "DENIED_REST_API",
"message": "Denied api call",
"data": {
"status": 403
}
}
6. Invalid API Key / Token #
{
"code": "rtcl_rest_authentication_error",
"message": "Invalid API authentication credentials.",
"data": {
"status": 403
}
}
7. Missing Authorization Header #
{
"status": "error",
"error": "MISSING_AUTHORIZATION_HEADER",
"code": "401",
"error_message": "Authorization header not received. Either authorization header was not sent or it was removed by your server due to security reasons."
}
8. Invalid Authorization Token Type #
{
"status": "error",
"error": "INVALID_AUTHORIZATION_HEADER_TOKEN_TYPE",
"code": "401",
"error_message": "Authorization header must be type of Bearer Token."
}
9. Invalid JWT Format (Segment Fault) #
{
"status": "error",
"error": "SEGMENT_FAULT",
"code": "401",
"error_message": "Incorrect JWT Format."
}
10. Invalid JWT Signature #
{
"status": "error",
"error": "INVALID_TOKEN",
"code": "401",
"error_message": "JWT signature verification failed."
}