FRONTEND GUIDE FOR AI CODING AGENTS - PART 8 - Networking 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 networking
Service Access
Networking service management is handled through service specific base urls.
Networking 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 networking service, the base URLs are:
- Preview:
https://linkedin.prw.mindbricks.com/networking-api - Staging:
https://linkedin-stage.mindbricks.co/networking-api - Production:
https://linkedin.mindbricks.co/networking-api
Scope
Networking Service Description
Handles professional networking logic for user-to-user connections: manages connection requests, accepted relationships, listing/removal, permissions, and state transitions. Publishes connection lifecycle events for notification…
Networking 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.
connection Data Object: Represents a single established user-to-user professional relationship (mutual connection). One record per unordered user pair, deleted on disconnect…
connectionRequest Data Object: Tracks a user's request to connect with another user, supporting request/accept/reject/cancel, with audit timestamps.
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:
{
"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.
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
Connection Data Object
Represents a single established user-to-user professional relationship (mutual connection). One record per unordered user pair, deleted on disconnect…
Connection Data Object Properties
Connection 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 |
|---|---|---|---|---|---|
connectedSince |
Date | false | Yes | No | - |
userId1 |
ID | false | Yes | No | - |
userId2 |
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
userId1 userId2
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.
- userId1: 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
- userId2: 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
ConnectionRequest Data Object
Tracks a user's request to connect with another user, supporting request/accept/reject/cancel, with audit timestamps.
ConnectionRequest Data Object Properties
ConnectionRequest 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 |
|---|---|---|---|---|---|
receiverUserId |
ID | false | Yes | No | - |
senderUserId |
ID | false | Yes | No | - |
sentAt |
Date | false | Yes | No | - |
status |
Enum | false | Yes | No | - |
respondedAt |
Date | false | No | No | - |
message |
String | 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.
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.
- status: [pending, accepted, rejected]
Relation Properties
receiverUserId senderUserId
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.
- receiverUserId: 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
- senderUserId: 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
status
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.
- status: Enum has a filter named
status
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.
Connection Default APIs
| Operation | API Name | Route | Explicitly Set |
|---|---|---|---|
| Create | createConnection |
/v1/connections |
Auto |
| Update | none | - | Auto |
| Delete | deleteConnection |
/v1/connections/:connectionId |
Auto |
| Get | getConnection |
/v1/connections/:connectionId |
Auto |
| List | listConnections |
/v1/connections |
Auto |
ConnectionRequest Default APIs
| Operation | API Name | Route | Explicitly Set |
|---|---|---|---|
| Create | createConnectionRequest |
/v1/connectionrequests |
Auto |
| Update | updateConnectionRequest |
/v1/connectionrequests/:connectionRequestId |
Auto |
| Delete | deleteConnectionRequest |
/v1/connectionrequests/:connectionRequestId |
Auto |
| Get | getConnectionRequest |
/v1/connectionrequests/:connectionRequestId |
Auto |
| List | listConnectionRequests |
/v1/connectionrequests |
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 Connection API
Create Connection
Rest Route
The createConnection API REST controller can be triggered via the following route:
/v1/connections
Rest Request Parameters
The createConnection api has got 2 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| userId1 | ID | true | request.body?.[“userId1”] |
| userId2 | ID | true | request.body?.[“userId2”] |
| userId1 : | |||
| userId2 : |
REST Request To access the api you can use the REST controller with the path POST /v1/connections
axios({
method: 'POST',
url: '/v1/connections',
data: {
userId1:"ID",
userId2:"ID",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "connection",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"connection": {
"id": "ID",
"connectedSince": "Date",
"userId1": "ID",
"userId2": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Delete Connectionrequest API
Sender or receiver may cancel/delete a connection request (soft-delete).
Rest Route
The deleteConnectionRequest API REST controller can be triggered via the following route:
/v1/connectionrequests/:connectionRequestId
Rest Request Parameters
The deleteConnectionRequest api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| connectionRequestId | ID | true | request.params?.[“connectionRequestId”] |
| connectionRequestId : 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/connectionrequests/:connectionRequestId
axios({
method: 'DELETE',
url: `/v1/connectionrequests/${connectionRequestId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "connectionRequest",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"connectionRequest": {
"id": "ID",
"receiverUserId": "ID",
"senderUserId": "ID",
"sentAt": "Date",
"status": "Enum",
"status_idx": "Integer",
"respondedAt": "Date",
"message": "String",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Update Connectionrequest API
Allows receiver of a pending connection request to accept or reject request.
Rest Route
The updateConnectionRequest API REST controller can be triggered via the following route:
/v1/connectionrequests/:connectionRequestId
Rest Request Parameters
The updateConnectionRequest api has got 3 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| connectionRequestId | ID | true | request.params?.[“connectionRequestId”] |
| status | Enum | true | request.body?.[“status”] |
| respondedAt | Date | false | request.body?.[“respondedAt”] |
| connectionRequestId : This id paremeter is used to select the required data object that will be updated | |||
| status : | |||
| respondedAt : |
REST Request To access the api you can use the REST controller with the path PATCH /v1/connectionrequests/:connectionRequestId
axios({
method: 'PATCH',
url: `/v1/connectionrequests/${connectionRequestId}`,
data: {
status:"Enum",
respondedAt:"Date",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "connectionRequest",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"connectionRequest": {
"id": "ID",
"receiverUserId": "ID",
"senderUserId": "ID",
"sentAt": "Date",
"status": "Enum",
"status_idx": "Integer",
"respondedAt": "Date",
"message": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
List Connections API
List all active connections where session user is a participant.
Rest Route
The listConnections API REST controller can be triggered via the following route:
/v1/connections
Rest Request Parameters
The listConnections api has got no request parameters.
REST Request To access the api you can use the REST controller with the path GET /v1/connections
axios({
method: 'GET',
url: '/v1/connections',
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "connections",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"connections": [
{
"id": "ID",
"connectedSince": "Date",
"userId1": "ID",
"userId2": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
List Connectionrequests API
List connection requests involving current user, filterable by status (pending, accepted, rejected).
Rest Route
The listConnectionRequests API REST controller can be triggered via the following route:
/v1/connectionrequests
Rest Request Parameters
Filter Parameters
The listConnectionRequests api supports 1 optional filter parameter for filtering list results:
status (Enum): Filter by status
- Single:
?status=<value>(case-insensitive) - Multiple:
?status=<value1>&status=<value2> - Null:
?status=null
REST Request To access the api you can use the REST controller with the path GET /v1/connectionrequests
axios({
method: 'GET',
url: '/v1/connectionrequests',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// status: '<value>' // Filter by status
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "connectionRequests",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"connectionRequests": [
{
"id": "ID",
"receiverUserId": "ID",
"senderUserId": "ID",
"sentAt": "Date",
"status": "Enum",
"status_idx": "Integer",
"respondedAt": "Date",
"message": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
Create Connectionrequest API
Send a new connection request from logged-in user to another user.
Rest Route
The createConnectionRequest API REST controller can be triggered via the following route:
/v1/connectionrequests
Rest Request Parameters
The createConnectionRequest api has got 4 regular request parameters
| Parameter | Type | Required | Population |
|---|---|---|---|
| receiverUserId | ID | true | request.body?.[“receiverUserId”] |
| status | Enum | true | request.body?.[“status”] |
| respondedAt | Date | false | request.body?.[“respondedAt”] |
| message | String | false | request.body?.[“message”] |
| receiverUserId : | |||
| status : | |||
| respondedAt : | |||
| message : |
REST Request To access the api you can use the REST controller with the path POST /v1/connectionrequests
axios({
method: 'POST',
url: '/v1/connectionrequests',
data: {
receiverUserId:"ID",
status:"Enum",
respondedAt:"Date",
message:"String",
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "connectionRequest",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"connectionRequest": {
"id": "ID",
"receiverUserId": "ID",
"senderUserId": "ID",
"sentAt": "Date",
"status": "Enum",
"status_idx": "Integer",
"respondedAt": "Date",
"message": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Delete Connection API
Break (delete) the connection between two users. Either user may disconnect.
Rest Route
The deleteConnection API REST controller can be triggered via the following route:
/v1/connections/:connectionId
Rest Request Parameters
The deleteConnection api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| connectionId | ID | true | request.params?.[“connectionId”] |
| connectionId : 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/connections/:connectionId
axios({
method: 'DELETE',
url: `/v1/connections/${connectionId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "connection",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"connection": {
"id": "ID",
"connectedSince": "Date",
"userId1": "ID",
"userId2": "ID",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Get Connectionrequest API
Get a specific connection request by ID if sender/receiver.
Rest Route
The getConnectionRequest API REST controller can be triggered via the following route:
/v1/connectionrequests/:connectionRequestId
Rest Request Parameters
The getConnectionRequest api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| connectionRequestId | ID | true | request.params?.[“connectionRequestId”] |
| connectionRequestId : 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/connectionrequests/:connectionRequestId
axios({
method: 'GET',
url: `/v1/connectionrequests/${connectionRequestId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "connectionRequest",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"connectionRequest": {
"id": "ID",
"receiverUserId": "ID",
"senderUserId": "ID",
"sentAt": "Date",
"status": "Enum",
"status_idx": "Integer",
"respondedAt": "Date",
"message": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
Get Connection API
Get connection between session user and another user (if exists, not soft-deleted).
Rest Route
The getConnection API REST controller can be triggered via the following route:
/v1/connections/:connectionId
Rest Request Parameters
The getConnection api has got 1 regular request parameter
| Parameter | Type | Required | Population |
|---|---|---|---|
| connectionId | ID | true | request.params?.[“connectionId”] |
| connectionId : 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/connections/:connectionId
axios({
method: 'GET',
url: `/v1/connections/${connectionId}`,
data: {
},
params: {
}
});
REST Response
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "connection",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"connection": {
"id": "ID",
"connectedSince": "Date",
"userId1": "ID",
"userId2": "ID",
"isActive": true,
"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.