# Add a new native messaging host Adds a new native messaging host. If a host with the same name already exists, returns the existing record. ## Endpoints **POST** `/bsp/api/v1/bmp/nativehost` ## Request URL `https://{server-hostname}:8383/bsp/api/v1/bmp/nativehost` ## Scope `BrowserManager.CREATE` ## Header `Authorization: d92d4xxxxxxxxxxxxx15f52` ## Request Parameters ### Request Headers - **Content-Type** (`string`, **Mandatory**): `application/json` - **Accept** (`string`, **Mandatory**): `application/json` ### Request Body JSON body with the native messaging host name to add. `application/json` - JSON Object - **name** (`string`, Optional): Native messaging host identifier to add. Must be a valid URL-safe string, max 2048 characters. If a host with the same name already exists, the existing record is returned. ## Sample Request ```curl curl --request POST \ --url https://appdomain/bsp/api/v1/bmp/nativehost \ --header 'Accept: application/json' \ --header 'Authorization: d92d4xxxxxxxxxxxxx15f52' \ --header 'Content-Type: application/json' \ --data '{"name":"com.example.nativehost"}' ``` ## Sample Request Body ### Add a new native messaging host for Chrome extensions ```json { "name": "com.example.nativehost" } ``` ### Add a Google Chrome remote desktop native host ```json { "name": "com.google.chrome.remote_desktop" } ``` ## Response Parameters ### HTTP Code 200 Response Body — `application/json` - JSON Object - **id** (`string`): Unique identifier for the native messaging host. - **name** (`string`): Native messaging host identifier string (e.g., com.example.nativehost). ### HTTP Code 401 Response Body — `application/json` - JSON Object - **errorCode** (`long`): Unauthorized error code returned when authentication credentials are missing, expired, or invalid (authentication=required). - **errorMsg** (`string`): Authentication failure reason. ### HTTP Code 403 Response Body — `application/json` - JSON Object - **errorCode** (`long`): Forbidden error code returned when the authenticated user does not have the required uem-roles (e.g., DataEncryption_Admin or DataEncryptionRecoveryKey_Admin). - **errorMsg** (`string`): Message indicating insufficient privileges to access this resource. ### HTTP Code 429 Response Body — `application/json` - JSON Object - **errorCode** (`long`): Rate limit error code returned when the API call threshold (configured via threshold/duration in security XML) is exceeded; client is locked out for lock-period minutes. - **errorMsg** (`string`): Rate limit exceeded message with retry guidance. ### HTTP Code 500 Response Body — `application/json` - JSON Object - **error_description** (`string`): Message describing the internal server error. - **error_code** (`string`): Error code identifying the type of server error. ## Possible Response Codes - **200** — HTTP code - **401** — HTTP code - **403** — HTTP code - **429** — HTTP code - **500** — HTTP code ## Sample Response: HTTP 200 ### Newly created native messaging host with assigned ID ```json { "name": "com.example.nativehost", "id": "1" } ``` ### Host with same name already existed returns existing record ```json { "name": "com.google.chrome.remote_desktop", "id": "5" } ``` ## Sample Response: HTTP 401 Authentication credentials are missing or invalid. ```json { "errorCode": "UNAUTHORIZED", "errorMsg": "You are not authorized to perform this action" } ``` ## Sample Response: HTTP 403 The user does not have the required permissions to perform this action. ```json { "errorCode": "FORBIDDEN", "errorMsg": "You do not have permission to access this resource" } ``` ## Sample Response: HTTP 429 Too many API requests have been made. ```json { "errorCode": "RATE_LIMIT_EXCEEDED", "errorMsg": "You have exceeded the maximum number of API calls. Please try again later." } ``` ## Sample Response: HTTP 500 An unexpected server error occurred. ```json { "error_description": "Internal Server error, Please try again in a moment.", "error_code": "COM0004" } ``` ## Rate Limits ![ ](https://www.zohowebstatic.com/sites/zweb/images/people/ico-help.png) **Duration:** 1 minute | **Threshold:** 60 | **Lock period:** 5 minutes Duration - Time window for the threshold. Threshold - Number of API calls allowed within the specified duration. Lock Period - Wait time before consecutive API requests.