Skip to content

Latest commit

 

History

History
269 lines (175 loc) · 7.48 KB

File metadata and controls

269 lines (175 loc) · 7.48 KB

sendx.PostApi

All URIs are relative to https://api.sendx.io/api/v1/rest

Method HTTP request Description
createPost POST /post Create blog post
deletePost DELETE /post/{identifier} Delete post
getAllPosts GET /post Get all posts
getPost GET /post/{identifier} Get post by ID
updatePost PUT /post/{identifier} Update post

createPost

RestRPost createPost(restEPost)

Create blog post

Creates a new blog post.

Example

import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';

let apiInstance = new sendx.PostApi();
let restEPost = {"name":"launch_draft_2025","postTitle":"Upcoming Product Launch"}; // RestEPost | 
apiInstance.createPost(restEPost).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
restEPost RestEPost

Return type

RestRPost

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deletePost

MessageResponse deletePost(identifier)

Delete post

Soft deletes a blog post. 🎯 Key Features: - Soft delete - Preserve data - Remove from listings

Example

import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';

let apiInstance = new sendx.PostApi();
let identifier = "contact_BnKjkbBBS500CoBCP0oChQ"; // String | Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`)  **Format:** `<prefix>_<22-character-id>` 
apiInstance.deletePost(identifier).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
identifier String Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`) Format: `<prefix>_<22-character-id>`

Return type

MessageResponse

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getAllPosts

[RestRPost] getAllPosts(opts)

Get all posts

Retrieves all blog posts with pagination. 🎯 Key Features: - Filter by status - Search functionality - Sort options - Include metadata

Example

import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';

let apiInstance = new sendx.PostApi();
let opts = {
  'offset': 0, // Number | Number of posts to skip
  'limit': 10 // Number | Maximum number of posts to return
};
apiInstance.getAllPosts(opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
offset Number Number of posts to skip [optional] [default to 0]
limit Number Maximum number of posts to return [optional] [default to 10]

Return type

[RestRPost]

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getPost

RestRPost getPost(identifier)

Get post by ID

Retrieves a specific blog post. 🎯 Key Features: - Full post content - SEO metadata - Related posts - Engagement metrics

Example

import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';

let apiInstance = new sendx.PostApi();
let identifier = "contact_BnKjkbBBS500CoBCP0oChQ"; // String | Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`)  **Format:** `<prefix>_<22-character-id>` 
apiInstance.getPost(identifier).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
identifier String Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`) Format: `<prefix>_<22-character-id>`

Return type

RestRPost

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

updatePost

RestRPost updatePost(restEPost, identifier)

Update post

Updates an existing blog post. 🎯 Key Features: - Edit content - Update metadata - Change status - Modify tags/categories

Example

import sendx from 'sendx-javascript-sdk';
let defaultClient = sendx.ApiClient.instance;
// Configure API key authorization: TeamApiKey
let TeamApiKey = defaultClient.authentications['TeamApiKey'];
TeamApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TeamApiKey.apiKeyPrefix = 'Token';

let apiInstance = new sendx.PostApi();
let restEPost = new sendx.RestEPost(); // RestEPost | 
let identifier = "contact_BnKjkbBBS500CoBCP0oChQ"; // String | Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`)  **Format:** `<prefix>_<22-character-id>` 
apiInstance.updatePost(restEPost, identifier).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
restEPost RestEPost
identifier String Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`) Format: `<prefix>_<22-character-id>`

Return type

RestRPost

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json