

# **LINKEDIN**

**FRONTEND GUIDE FOR AI CODING AGENTS - PART 10 - Content Service**

This document is a part of a REST API guide for the linkedin project.
It is designed for AI agents that will generate frontend code to consume the project’s backend.

This document provides extensive instruction for the usage of content

## Service Access

Content service management is handled through service specific base urls.

Content  service may be deployed to the preview server, staging server, or production server. Therefore,it has 3 access URLs.
The frontend application must support all deployment environments during development, and the user should be able to select the target API server on the login page (already handled in first part.).

For the content service, the base URLs are:

* **Preview:** `https://linkedin.prw.mindbricks.com/content-api`
* **Staging:** `https://linkedin-stage.mindbricks.co/content-api`
* **Production:** `https://linkedin.mindbricks.co/content-api`


## Scope

**Content Service Description**

Handles creation, editing, and deletion of user posts (with attachments and visibility), user post feed aggregation, and post engagement (likes, comments). All with post-level visibility control (public/private)..

Content service provides apis and business logic for following data objects in linkedin application. 
Each data object may be either a central domain of the application data structure or a related helper data object for a central concept.
Note that data object concept is equal to table concept in the database, in the service database each data object is represented as a db table scheme and the object instances as table rows.  


**`post` Data Object**: A user or company-authored post in the feed, with content, optional attachments, and public/private visibility. Belongs to a user (author) and optionally a company.

**`like` Data Object**: A record of a user liking a specific post. Each user can like a post only once. Used for engagement counts and activity feeds.

**`comment` Data Object**: A comment on a post. Can be a top-level or a reply to another comment (via parentCommentId).



## API Structure

### Object Structure of a Successful Response

When the service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope includes the data and essential metadata such as configuration details and pagination information, providing context to the client.

**HTTP Status Codes:**

* **200 OK**: Returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request was processed successfully.
* **201 Created**: Returned for CREATE operations, indicating that the resource was created successfully.

**Success Response Format:**

For successful operations, the response includes a `"status": "OK"` property, signaling that the request executed successfully. The structure of a successful response is outlined below:

```json
{
  "status":"OK",
  "statusCode": 200,   
  "elapsedMs":126,
  "ssoTime":120,
  "source": "db",
  "cacheKey": "hexCode",
  "userId": "ID",
  "sessionId": "ID",
  "requestId": "ID",
  "dataName":"products",
  "method":"GET",
  "action":"list",
  "appVersion":"Version",
  "rowCount":3,
  "products":[{},{},{}],
  "paging": {
    "pageNumber":1, 
    "pageRowCount":25, 
    "totalRowCount":3,
    "pageCount":1
  },
  "filters": [],
  "uiPermissions": []
}
```
* **`products`**: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation.

### Additional Data

Each API may include additional data besides the main data object, depending on the business logic of the API. These will be provided in each API’s response signature.

### Error Response

If a request encounters an issue—whether due to a logical fault or a technical problem—the service responds with a standardized JSON error structure. The HTTP status code indicates the nature of the error, using commonly recognized codes for clarity:

* **400 Bad Request**: The request was improperly formatted or contained invalid parameters.
* **401 Unauthorized**: The request lacked a valid authentication token; login is required.
* **403 Forbidden**: The current token does not grant access to the requested resource.
* **404 Not Found**: The requested resource was not found on the server.
* **500 Internal Server Error**: The server encountered an unexpected condition.

Each error response is structured to provide meaningful insight into the problem, assisting in efficient diagnosis and resolution.

```js
{
  "result": "ERR",
  "status": 400,
  "message": "errMsg_organizationIdisNotAValidID",
  "errCode": 400,
  "date": "2024-03-19T12:13:54.124Z",
  "detail": "String"
}
```


## Post Data Object

A user or company-authored post in the feed, with content, optional attachments, and public/private visibility. Belongs to a user (author) and optionally a company.



### Post Data Object Properties

Post data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `content` | Text | false | Yes | No | - |
| `companyId` | ID | false | No | No | - |
| `authorUserId` | ID | false | Yes | No | - |
| `visibility` | Enum | false | Yes | No | - |
| `attachmentUrls` | String | true | No | No | - |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.


### Array Properties 

`attachmentUrls`

Array properties can hold multiple values. 
Array properties should be respected according to their multiple structure in the frontend in any user input for them.
Please use multiple input components for the array proeprties when needed.


### Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. 
The enum options value will be stored as strings in the database, 
but when a data object is created an additional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option.
You can use the {fieldName_idx} property to sort by the enum value or when your enum options represent a hiyerarchy of values.
In the frontend input components, enum type properties should only accept values from an option component that lists the enum options.

- **visibility**: [public, private]


### Relation Properties

`companyId` `authorUserId`

Mindbricks supports relations between data objects, allowing you to define how objects are linked together.
The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search.
These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects.
If the relation points to another service, frontend should use the referenced service api in case it needs related data.
The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. 
In mmost cases the api response will provide the relational data as well as the main one.

In frontend, please ensure that, 

1- instaead of these relational ids you show the main human readable field of the related target data (like name),
2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.


- **companyId**: ID
Relation to `company`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: No

- **authorUserId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes


### Filter Properties

`companyId` `authorUserId` `visibility`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's.

- **companyId**: ID  has a filter named `companyId`

- **authorUserId**: ID  has a filter named `authorUserId`

- **visibility**: Enum  has a filter named `visibility`


## Like Data Object

A record of a user liking a specific post. Each user can like a post only once. Used for engagement counts and activity feeds.



### Like Data Object Properties

Like data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `likedAt` | Date | false | Yes | No | - |
| `postId` | ID | false | Yes | No | - |
| `userId` | ID | false | Yes | No | - |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.




### Relation Properties

`postId` `userId`

Mindbricks supports relations between data objects, allowing you to define how objects are linked together.
The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search.
These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects.
If the relation points to another service, frontend should use the referenced service api in case it needs related data.
The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. 
In mmost cases the api response will provide the relational data as well as the main one.

In frontend, please ensure that, 

1- instaead of these relational ids you show the main human readable field of the related target data (like name),
2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.


- **postId**: ID
Relation to `post`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes

- **userId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes


### Filter Properties

`postId` `userId`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's.

- **postId**: ID  has a filter named `postId`

- **userId**: ID  has a filter named `userId`


## Comment Data Object

A comment on a post. Can be a top-level or a reply to another comment (via parentCommentId).



### Comment Data Object Properties

Comment data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `authorUserId` | ID | false | Yes | No | - |
| `postId` | ID | false | Yes | No | - |
| `content` | Text | false | Yes | No | - |
| `parentCommentId` | ID | false | No | No | - |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.




### Relation Properties

`authorUserId` `postId` `parentCommentId`

Mindbricks supports relations between data objects, allowing you to define how objects are linked together.
The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search.
These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects.
If the relation points to another service, frontend should use the referenced service api in case it needs related data.
The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. 
In mmost cases the api response will provide the relational data as well as the main one.

In frontend, please ensure that, 

1- instaead of these relational ids you show the main human readable field of the related target data (like name),
2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.


- **authorUserId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes

- **postId**: ID
Relation to `post`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes

- **parentCommentId**: ID
Relation to `comment`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: No


### Filter Properties

`postId`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's.

- **postId**: ID  has a filter named `postId`



## Default CRUD APIs

For each data object, the backend architect may designate **default APIs** for standard operations (create, update, delete, get, list). These are the APIs that frontend CRUD forms and AI agents should use for basic record management. If no default is explicitly set (`isDefaultApi`), the frontend generator auto-discovers the most general API for each operation.

### Post Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | `createPost` | `/v1/posts` | Auto |
| Update | `updatePost` | `/v1/posts/:postId` | Auto |
| Delete | `deletePost` | `/v1/posts/:postId` | Auto |
| Get | `getPost` | `/v1/posts/:postId` | Auto |
| List | `listPosts` | `/v1/posts` | Auto |
### Like Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | `likePost` | `/v1/likepost` | Auto |
| Update | _none_ | - | Auto |
| Delete | `unlikePost` | `/v1/unlikepost/:likeId` | Auto |
| Get | _none_ | - | Auto |
| List | `listLikes` | `/v1/likes` | Auto |
### Comment Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | `createComment` | `/v1/comments` | Auto |
| Update | `updateComment` | `/v1/comments/:commentId` | Auto |
| Delete | `deleteComment` | `/v1/comments/:commentId` | Auto |
| Get | `getComment` | `/v1/comments/:commentId` | Auto |
| List | `listComments` | `/v1/comments` | Auto |

When building CRUD forms for a data object, use the default create/update APIs listed above. The form fields should correspond to the API's body parameters. For relation fields, render a dropdown loaded from the related object's list API using the display label property.





## API Reference

### `Create Post` API
Create a new post for the authenticated user. Visibility defaults to public. Posts can optionally belong to a company if author is a company admin. Attachments optional.


**Rest Route**

The `createPost` API REST controller can be triggered via the following route:

`/v1/posts`


**Rest Request Parameters**


The `createPost` api has got 5 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| content  | Text  | true | request.body?.["content"] |
| companyId  | ID  | false | request.body?.["companyId"] |
| authorUserId  | ID  | true | request.body?.["authorUserId"] |
| visibility  | Enum  | true | request.body?.["visibility"] |
| attachmentUrls  | String  | false | request.body?.["attachmentUrls"] |
**content** : 
**companyId** : 
**authorUserId** : 
**visibility** : 
**attachmentUrls** : 



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/posts**
```js
  axios({
    method: 'POST',
    url: '/v1/posts',
    data: {
            content:"Text",  
            companyId:"ID",  
            authorUserId:"ID",  
            visibility:"Enum",  
            attachmentUrls:"String",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "post",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"post": {
		"id": "ID",
		"content": "Text",
		"companyId": "ID",
		"authorUserId": "ID",
		"visibility": "Enum",
		"visibility_idx": "Integer",
		"attachmentUrls": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Update Comment` API
Update an existing comment. Only the author can update.


**Rest Route**

The `updateComment` API REST controller can be triggered via the following route:

`/v1/comments/:commentId`


**Rest Request Parameters**


The `updateComment` api has got 3 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| commentId  | ID  | true | request.params?.["commentId"] |
| content  | Text  | false | request.body?.["content"] |
| parentCommentId  | ID  | false | request.body?.["parentCommentId"] |
**commentId** : This id paremeter is used to select the required data object that will be updated
**content** : 
**parentCommentId** : 



**REST Request**
To access the api you can use the **REST** controller with the path **PATCH  /v1/comments/:commentId**
```js
  axios({
    method: 'PATCH',
    url: `/v1/comments/${commentId}`,
    data: {
            content:"Text",  
            parentCommentId:"ID",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "comment",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"comment": {
		"id": "ID",
		"authorUserId": "ID",
		"postId": "ID",
		"content": "Text",
		"parentCommentId": "ID",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `List Posts` API
List posts matching filters, honoring post visibility. Public posts shown to all; private posts only to owners. Supports filtering by author, company, and visibility. Feed aggregation is handled at higher BFF layer.


**Rest Route**

The `listPosts` API REST controller can be triggered via the following route:

`/v1/posts`


**Rest Request Parameters**



**Filter Parameters**

The `listPosts` api supports 3 optional filter parameters for filtering list results:

**companyId** (`ID`): Filter by companyId

- Single: `?companyId=<value>`
- Multiple: `?companyId=<value1>&companyId=<value2>`
- Null: `?companyId=null`


**authorUserId** (`ID`): Filter by authorUserId

- Single: `?authorUserId=<value>`
- Multiple: `?authorUserId=<value1>&authorUserId=<value2>`
- Null: `?authorUserId=null`


**visibility** (`Enum`): Filter by visibility

- Single: `?visibility=<value>` (case-insensitive)
- Multiple: `?visibility=<value1>&visibility=<value2>`
- Null: `?visibility=null`



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/posts**
```js
  axios({
    method: 'GET',
    url: '/v1/posts',
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // companyId: '<value>' // Filter by companyId
        // authorUserId: '<value>' // Filter by authorUserId
        // visibility: '<value>' // Filter by visibility
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "posts",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"posts": [
		{
			"id": "ID",
			"content": "Text",
			"companyId": "ID",
			"authorUserId": "ID",
			"visibility": "Enum",
			"visibility_idx": "Integer",
			"attachmentUrls": "String",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Like Post` API
Like a post. User can like a post only once; duplicate likes prevented.


**Rest Route**

The `likePost` API REST controller can be triggered via the following route:

`/v1/likepost`


**Rest Request Parameters**


The `likePost` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| postId  | ID  | true | request.body?.["postId"] |
**postId** : 



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/likepost**
```js
  axios({
    method: 'POST',
    url: '/v1/likepost',
    data: {
            postId:"ID",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "like",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"like": {
		"id": "ID",
		"likedAt": "Date",
		"postId": "ID",
		"userId": "ID",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Get Post` API
Get a post by ID. Public posts visible to all. Private only visible to author or company admin (if company post).


**Rest Route**

The `getPost` API REST controller can be triggered via the following route:

`/v1/posts/:postId`


**Rest Request Parameters**


The `getPost` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| postId  | ID  | true | request.params?.["postId"] |
**postId** : This id paremeter is used to query the required data object.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/posts/:postId**
```js
  axios({
    method: 'GET',
    url: `/v1/posts/${postId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "post",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"post": {
		"id": "ID",
		"content": "Text",
		"companyId": "ID",
		"authorUserId": "ID",
		"visibility": "Enum",
		"visibility_idx": "Integer",
		"attachmentUrls": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Create Comment` API
Add a new comment to a post. Can be top-level (parentCommentId null) or a reply. Only authenticated users can comment.


**Rest Route**

The `createComment` API REST controller can be triggered via the following route:

`/v1/comments`


**Rest Request Parameters**


The `createComment` api has got 3 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| postId  | ID  | true | request.body?.["postId"] |
| content  | Text  | true | request.body?.["content"] |
| parentCommentId  | ID  | false | request.body?.["parentCommentId"] |
**postId** : 
**content** : 
**parentCommentId** : 



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/comments**
```js
  axios({
    method: 'POST',
    url: '/v1/comments',
    data: {
            postId:"ID",  
            content:"Text",  
            parentCommentId:"ID",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "comment",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"comment": {
		"id": "ID",
		"authorUserId": "ID",
		"postId": "ID",
		"content": "Text",
		"parentCommentId": "ID",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Delete Post` API
Delete (soft-delete) a post. Only the author (or company admin for company posts) may delete.


**Rest Route**

The `deletePost` API REST controller can be triggered via the following route:

`/v1/posts/:postId`


**Rest Request Parameters**


The `deletePost` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| postId  | ID  | true | request.params?.["postId"] |
**postId** : This id paremeter is used to select the required data object that will be deleted



**REST Request**
To access the api you can use the **REST** controller with the path **DELETE  /v1/posts/:postId**
```js
  axios({
    method: 'DELETE',
    url: `/v1/posts/${postId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "post",
	"method": "DELETE",
	"action": "delete",
	"appVersion": "Version",
	"rowCount": 1,
	"post": {
		"id": "ID",
		"content": "Text",
		"companyId": "ID",
		"authorUserId": "ID",
		"visibility": "Enum",
		"visibility_idx": "Integer",
		"attachmentUrls": "String",
		"isActive": false,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Update Post` API
Update content, visibility, or attachments of an existing post by its owner or company admin (if company post).


**Rest Route**

The `updatePost` API REST controller can be triggered via the following route:

`/v1/posts/:postId`


**Rest Request Parameters**


The `updatePost` api has got 5 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| postId  | ID  | true | request.params?.["postId"] |
| content  | Text  | false | request.body?.["content"] |
| companyId  | ID  | false | request.body?.["companyId"] |
| visibility  | Enum  | false | request.body?.["visibility"] |
| attachmentUrls  | String  | false | request.body?.["attachmentUrls"] |
**postId** : This id paremeter is used to select the required data object that will be updated
**content** : 
**companyId** : 
**visibility** : 
**attachmentUrls** : 



**REST Request**
To access the api you can use the **REST** controller with the path **PATCH  /v1/posts/:postId**
```js
  axios({
    method: 'PATCH',
    url: `/v1/posts/${postId}`,
    data: {
            content:"Text",  
            companyId:"ID",  
            visibility:"Enum",  
            attachmentUrls:"String",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "post",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"post": {
		"id": "ID",
		"content": "Text",
		"companyId": "ID",
		"authorUserId": "ID",
		"visibility": "Enum",
		"visibility_idx": "Integer",
		"attachmentUrls": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `List Likes` API
List likes on a given post (or by user). Supports filtering by postId and userId.


**Rest Route**

The `listLikes` API REST controller can be triggered via the following route:

`/v1/likes`


**Rest Request Parameters**



**Filter Parameters**

The `listLikes` api supports 2 optional filter parameters for filtering list results:

**postId** (`ID`): Filter by postId

- Single: `?postId=<value>`
- Multiple: `?postId=<value1>&postId=<value2>`
- Null: `?postId=null`


**userId** (`ID`): Filter by userId

- Single: `?userId=<value>`
- Multiple: `?userId=<value1>&userId=<value2>`
- Null: `?userId=null`



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/likes**
```js
  axios({
    method: 'GET',
    url: '/v1/likes',
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // postId: '<value>' // Filter by postId
        // userId: '<value>' // Filter by userId
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "likes",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"likes": [
		{
			"id": "ID",
			"likedAt": "Date",
			"postId": "ID",
			"userId": "ID",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Unlike Post` API
Undo a like by user for a given post. Soft-deletes the like record.


**Rest Route**

The `unlikePost` API REST controller can be triggered via the following route:

`/v1/unlikepost/:likeId`


**Rest Request Parameters**


The `unlikePost` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| likeId  | ID  | true | request.params?.["likeId"] |
**likeId** : This id paremeter is used to select the required data object that will be deleted



**REST Request**
To access the api you can use the **REST** controller with the path **DELETE  /v1/unlikepost/:likeId**
```js
  axios({
    method: 'DELETE',
    url: `/v1/unlikepost/${likeId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "like",
	"method": "DELETE",
	"action": "delete",
	"appVersion": "Version",
	"rowCount": 1,
	"like": {
		"id": "ID",
		"likedAt": "Date",
		"postId": "ID",
		"userId": "ID",
		"isActive": false,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `List Comments` API
List comments for a post (or by parentComment). Supports filtering by postId and parentCommentId. Sorted by creation date ascending.


**Rest Route**

The `listComments` API REST controller can be triggered via the following route:

`/v1/comments`


**Rest Request Parameters**



**Filter Parameters**

The `listComments` api supports 1 optional filter parameter for filtering list results:

**postId** (`ID`): Filter by postId

- Single: `?postId=<value>`
- Multiple: `?postId=<value1>&postId=<value2>`
- Null: `?postId=null`



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/comments**
```js
  axios({
    method: 'GET',
    url: '/v1/comments',
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // postId: '<value>' // Filter by postId
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "comments",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"comments": [
		{
			"id": "ID",
			"authorUserId": "ID",
			"postId": "ID",
			"content": "Text",
			"parentCommentId": "ID",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Get Comment` API
Get a comment by ID. Any user can read comments. Soft-deleted comments not listed unless owner.


**Rest Route**

The `getComment` API REST controller can be triggered via the following route:

`/v1/comments/:commentId`


**Rest Request Parameters**


The `getComment` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| commentId  | ID  | true | request.params?.["commentId"] |
**commentId** : This id paremeter is used to query the required data object.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/comments/:commentId**
```js
  axios({
    method: 'GET',
    url: `/v1/comments/${commentId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "comment",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"comment": {
		"id": "ID",
		"authorUserId": "ID",
		"postId": "ID",
		"content": "Text",
		"parentCommentId": "ID",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `List Userposts` API
list all posts of a user


**Rest Route**

The `listUserPosts` API REST controller can be triggered via the following route:

`/v1/userposts`


**Rest Request Parameters**



**Filter Parameters**

The `listUserPosts` api supports 3 optional filter parameters for filtering list results:

**companyId** (`ID`): Filter by companyId

- Single: `?companyId=<value>`
- Multiple: `?companyId=<value1>&companyId=<value2>`
- Null: `?companyId=null`


**authorUserId** (`ID`): Filter by authorUserId

- Single: `?authorUserId=<value>`
- Multiple: `?authorUserId=<value1>&authorUserId=<value2>`
- Null: `?authorUserId=null`


**visibility** (`Enum`): Filter by visibility

- Single: `?visibility=<value>` (case-insensitive)
- Multiple: `?visibility=<value1>&visibility=<value2>`
- Null: `?visibility=null`



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/userposts**
```js
  axios({
    method: 'GET',
    url: '/v1/userposts',
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // companyId: '<value>' // Filter by companyId
        // authorUserId: '<value>' // Filter by authorUserId
        // visibility: '<value>' // Filter by visibility
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "posts",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"posts": [
		{
			"id": "ID",
			"content": "Text",
			"companyId": "ID",
			"authorUserId": "ID",
			"visibility": "Enum",
			"visibility_idx": "Integer",
			"attachmentUrls": "String",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Delete Comment` API
Delete (soft-delete) a comment. Only the author may delete.


**Rest Route**

The `deleteComment` API REST controller can be triggered via the following route:

`/v1/comments/:commentId`


**Rest Request Parameters**


The `deleteComment` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| commentId  | ID  | true | request.params?.["commentId"] |
**commentId** : This id paremeter is used to select the required data object that will be deleted



**REST Request**
To access the api you can use the **REST** controller with the path **DELETE  /v1/comments/:commentId**
```js
  axios({
    method: 'DELETE',
    url: `/v1/comments/${commentId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "comment",
	"method": "DELETE",
	"action": "delete",
	"appVersion": "Version",
	"rowCount": 1,
	"comment": {
		"id": "ID",
		"authorUserId": "ID",
		"postId": "ID",
		"content": "Text",
		"parentCommentId": "ID",
		"isActive": false,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```



**After this prompt, the user may give you new instructions to update the output of this prompt or provide subsequent prompts about the project.**


