# VmosoApi.PostApi

All URIs are relative to *https://www.vmoso.com/svc*

Method | HTTP request | Description
------------- | ------------- | -------------
[**createPost**](PostApi.md#createPost) | **POST** /postsV2 | 
[**deletePost**](PostApi.md#deletePost) | **DELETE** /postsV2/{key} | 
[**getPost**](PostApi.md#getPost) | **GET** /postsV2/{key} | 
[**getUsers**](PostApi.md#getUsers) | **GET** /postsV2/{postKey}/{segment} | 
[**updatePost**](PostApi.md#updatePost) | **PUT** /postsV2/{key} | 


<a name="createPost"></a>
# **createPost**
> CreatePostResult createPost(input)



Use this API to create a post.

### Example
```javascript
var VmosoApi = require('vmoso-api');
var defaultClient = VmosoApi.ApiClient.default;

// Configure API key authorization: vmoso_auth
var vmoso_auth = defaultClient.authentications['vmoso_auth'];
vmoso_auth.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//vmoso_auth.apiKeyPrefix['X-CV-Authorization'] = "Token"

var apiInstance = new VmosoApi.PostApi()

var input = new VmosoApi.CreatePostInput(); // {CreatePostInput} Post details and destinations


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.createPost(input, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **input** | [**CreatePostInput**](CreatePostInput.md)| Post details and destinations | 

### Return type

[**CreatePostResult**](CreatePostResult.md)

### Authorization

[vmoso_auth](../README.md#vmoso_auth)

### HTTP reuqest headers

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

<a name="deletePost"></a>
# **deletePost**
> DeletePostResult deletePost(key)



Use this API to delete a post.

### Example
```javascript
var VmosoApi = require('vmoso-api');
var defaultClient = VmosoApi.ApiClient.default;

// Configure API key authorization: vmoso_auth
var vmoso_auth = defaultClient.authentications['vmoso_auth'];
vmoso_auth.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//vmoso_auth.apiKeyPrefix['X-CV-Authorization'] = "Token"

var apiInstance = new VmosoApi.PostApi()

var key = "key_example"; // {String} ID of the post to delete.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.deletePost(key, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **key** | **String**| ID of the post to delete. | 

### Return type

[**DeletePostResult**](DeletePostResult.md)

### Authorization

[vmoso_auth](../README.md#vmoso_auth)

### HTTP reuqest headers

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

<a name="getPost"></a>
# **getPost**
> GetPostResult getPost(key, opts)



Use this API to view a post.

### Example
```javascript
var VmosoApi = require('vmoso-api');
var defaultClient = VmosoApi.ApiClient.default;

// Configure API key authorization: vmoso_auth
var vmoso_auth = defaultClient.authentications['vmoso_auth'];
vmoso_auth.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//vmoso_auth.apiKeyPrefix['X-CV-Authorization'] = "Token"

var apiInstance = new VmosoApi.PostApi()

var key = "key_example"; // {String} ID of the post to view.

var opts = { 
  'format': "format_example" // {String} Return record format.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getPost(key, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **key** | **String**| ID of the post to view. | 
 **format** | **String**| Return record format. | [optional] 

### Return type

[**GetPostResult**](GetPostResult.md)

### Authorization

[vmoso_auth](../README.md#vmoso_auth)

### HTTP reuqest headers

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

<a name="getUsers"></a>
# **getUsers**
> GetUsersResult getUsers(postKey, segment, opts)



Use this API to get all the users in a segment across multiple spaces.

### Example
```javascript
var VmosoApi = require('vmoso-api');
var defaultClient = VmosoApi.ApiClient.default;

// Configure API key authorization: vmoso_auth
var vmoso_auth = defaultClient.authentications['vmoso_auth'];
vmoso_auth.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//vmoso_auth.apiKeyPrefix['X-CV-Authorization'] = "Token"

var apiInstance = new VmosoApi.PostApi()

var postKey = "postKey_example"; // {String} Post ID.

var segment = "segment_example"; // {String} One of the following: Contacts, ContactGroups, ContactAndGroups

var opts = { 
  'options': "options_example", // {String} User group list options.
  'pg': "pg_example" // {String} Pagination options.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getUsers(postKey, segment, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **postKey** | **String**| Post ID. | 
 **segment** | **String**| One of the following: Contacts, ContactGroups, ContactAndGroups | 
 **options** | **String**| User group list options. | [optional] 
 **pg** | **String**| Pagination options. | [optional] 

### Return type

[**GetUsersResult**](GetUsersResult.md)

### Authorization

[vmoso_auth](../README.md#vmoso_auth)

### HTTP reuqest headers

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

<a name="updatePost"></a>
# **updatePost**
> UpdatePostResult updatePost(key, input)



Use this API to update a post.

### Example
```javascript
var VmosoApi = require('vmoso-api');
var defaultClient = VmosoApi.ApiClient.default;

// Configure API key authorization: vmoso_auth
var vmoso_auth = defaultClient.authentications['vmoso_auth'];
vmoso_auth.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//vmoso_auth.apiKeyPrefix['X-CV-Authorization'] = "Token"

var apiInstance = new VmosoApi.PostApi()

var key = "key_example"; // {String} ID of the post to update.

var input = new VmosoApi.UpdatePostInput(); // {UpdatePostInput} Changes to make to the post.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.updatePost(key, input, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **key** | **String**| ID of the post to update. | 
 **input** | [**UpdatePostInput**](UpdatePostInput.md)| Changes to make to the post. | 

### Return type

[**UpdatePostResult**](UpdatePostResult.md)

### Authorization

[vmoso_auth](../README.md#vmoso_auth)

### HTTP reuqest headers

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

