A plugin to publish blogs to your WordPress website.
/create-postThe /create-post endpoint is used to create a new post with the specified title, content, status, and author.
/wp-json/sm-connect/v1/create-postPOSTapplication/jsonTo create a new post, make a POST request with the required parameters included in the query string. You must also include an Authorization header with a valid Bearer token.
| Header | Value |
|---|---|
| Authorization | Bearer <your_access_token> |
| Parameter | Type | Description |
|---|---|---|
| title | string | The title of the post. |
| content | string | The content of the post. |
| status | string | The status of the post (e.g., publish). |
| author | int | The ID of the author of the post. |
| featured_image | string | URL of the new featured image for the post. |
$http({
method: 'POST',
url: 'SITE_URL/wp-json/sm-connect/v1/create-post',
headers: {
'Authorization': 'Bearer <your_access_token>',
'Content-Type': 'application/json'
},
data: {
title: 'Sample Title',
content: 'Sample content',
status: 'publish',
author: 1
}
}).then(function successCallback(response) {
console.log('Post created:', response.data.data);
}, function errorCallback(response) {
console.error('Error:', response.data.message);
});