add_project_comment

ArtificialIntelligenceApi.add_project_comment(project_id, role_id, add_project_comment_request=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Add a comment to an AI project

Posts a comment on an AI project and returns the identifier of the new comment. You need at least read-only access on the project, so any project member can comment. You are recorded as the author, and the comment is timestamped server-side. Project stewards are notified by email and push notification; if notification fails the comment is still saved and the call still succeeds.

Parameters:
  • project_id (str) – Identifier of the AI project to comment on. This is the ProjectId returned when the project was created. (required)

  • role_id (str) – Amorphic role used to authorize this request. (required)

  • add_project_comment_request (AddProjectCommentRequest)

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

AddProjectCommentResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /ai/projects/{project_id}/comments

Request

Request / response example

{
  "Type": "warning",
  "Description": "The sales knowledge base behind this project is refreshed weekly, so answers can lag by a few days."
}

Success (HTTP 200)

The comment was saved. CommentId is the identifier of the new comment; pass it to the delete endpoint to remove it later.

Request / response example

{
  "Message": "Comment added successfully",
  "CommentId": "01JMB7YQ4K9V2XZ3T5R8W6N0AC"
}

Errors

Documented error codes: AUTH-1001, AUTH-1030, AUTH-1012, IPV-1008, IPV-1041, IPV-1045, IPV-1076, GE-1008.

HTTP 400

The request was invalid or you do not have permission. The body is {“Message”: “<CODE> - <text>”}. Common cases include a missing role_id header (AUTH-1001), a role without the ai.view permission (AUTH-1030), no read-only access on the project (AUTH-1012), a missing Type or Description (IPV-1008), a Type outside the allowed values (IPV-1041), a Description that is empty or not a string (IPV-1045), and a Description longer than 1000 characters (IPV-1076). A body missing the required fields altogether is rejected by request validation before it reaches the service. Permission failures return 400, not 403.

Type or Description not supplied

{
  "Message": "IPV-1008 - Invalid request body, missing key(s) - ['Description']"
}

Unsupported comment type

{
  "Message": "IPV-1041 - Invalid parameter - Type, allowed values/keys are ['info', 'warning', 'error', 'deprecation']"
}

Comment text over the length limit

{
  "Message": "IPV-1076 - The length of parameter 'Description' exceeds the max limit(1000)"
}

Caller has no access to the project

{
  "Message": "AUTH-1012 - User: john.doe requires at least read-only access on the resource to perform this action."
}

HTTP 500

An unexpected server error, including a failure to store the comment. The body is {“Message”: “<CODE> - <text>”}, normally GE-1008.

Request / response example

{
  "Message": "GE-1008 - Could not complete the request. Please try again."
}