Comments

The Comments API allows you to create, list, retrieve, and delete comments on files and folders in an Egnyte domain. Comments can also be referred to as notes.

Base URL

https://{domain}.egnyte.com/pubapi/v1/notes

Authentication

All requests require an OAuth 2.0 Bearer token in the Authorization header:

Authorization: Bearer {access_token}

See Authentication for details on obtaining a token.


Add a Comment

Create a new comment on a file or folder.

Request

POST /pubapi/v1/notes

Request Body

FieldTypeRequiredDescription
pathstringYesPath to the file or folder where the comment should be added
bodystringYesThe text of the comment

Example Request

curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/notes" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -d '{
  "path": "/Shared/Documents/form.docx",
  "body": "Test comment"
}'

Response

200 OK

FieldTypeDescription
idstringUnique identifier (UUID) for the comment
messagestringThe text of the comment
usernamestringUsername of the comment author
can_deletebooleanWhether the current user can delete this comment
creation_timestringISO 8601 timestamp of when the comment was created
formatted_namestringDisplay name of the comment author
file_pathstringPath to the file or folder the comment is attached to
group_idstringUnique identifier for the associated group

Example Response

{
  "id": "4fbba2ef-fb2f-4c54-9392-116f07e39b97",
  "message": "Test comment",
  "username": "asmith",
  "can_delete": true,
  "creation_time": "2016-05-18T17:56:39.975+0000",
  "formatted_name": "Anna Smith",
  "file_path": "/Shared/Documents/testdoc.docx",
  "group_id": "628ceb16-b9a0-49f8-a0e4-72b729708f71"
}

List Comments

List all comments for a given file or folder. Administrators can omit the file parameter to list all comments for the domain.

Request

GET /pubapi/v1/notes

Query Parameters

ParameterTypeRequiredDefaultDescription
filestringNo—URL-encoded path to the file or folder. If omitted, returns all comments for the domain (admin only)
start_timestringNo—Return comments created after this time (ISO 8601 format). Must be less than end_time if both are provided
end_timestringNo—Return comments created before this time (ISO 8601 format)
countintegerNo25Number of results to return (max: 100)
offsetintegerNo0Zero-based index for pagination

Note: Dates and times must be in ISO 8601 format. For example, 2012-05-27T22:27:01Z represents 10:27:01 PM on May 27, 2012.

Example Request

curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/notes?file=%2FShared%2FDocuments%2Fform.docx&count=50" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response

200 OK

FieldTypeDescription
countintegerNumber of comments returned in this response
offsetintegerZero-based offset used for this request
total_resultsintegerTotal number of comments matching the query
notesarrayArray of comment objects (see Add a Comment response for object structure)

Example Response

{
  "count": 2,
  "offset": 0,
  "notes": [
    {
      "id": "4fbba2ef-fb2f-4c54-9392-116f07e39b97",
      "message": "Test comment",
      "username": "asmith",
      "can_delete": true,
      "creation_time": "2016-05-18T17:56:39.975+0000",
      "formatted_name": "Anna Smith",
      "file_path": "/Shared/Documents/testdoc.docx",
      "group_id": "628ceb16-b9a0-49f8-a0e4-72b729708f71"
    },
    {
      "id": "a7a809d3-1c2f-4dd0-8b65-3f2c78eac4c8",
      "message": "Test comment 2",
      "username": "asmith",
      "can_delete": true,
      "creation_time": "2016-05-18T18:06:26.000+0000",
      "formatted_name": "Anna Smith",
      "file_path": "/Shared/Documents/testdoc.docx",
      "group_id": "628ceb16-b9a0-49f8-a0e4-72b729708f71"
    }
  ],
  "total_results": 2
}

Show Comment

Retrieve the details for a specific comment.

Request

GET /pubapi/v1/notes/{uuid}

Path Parameters

ParameterTypeRequiredDescription
uuidstringYesThe unique identifier for the comment

Example Request

curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/notes/a7a809d3-1c2f-4dd0-8b65-3f2c78eac4c8" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response

200 OK

Returns a single comment object. See Add a Comment response for field descriptions.

Example Response

{
  "id": "a7a809d3-1c2f-4dd0-8b65-3f2c78eac4c8",
  "message": "Test comment 2",
  "username": "asmith",
  "can_delete": true,
  "creation_time": "2016-05-18T18:06:26.000+0000",
  "formatted_name": "Anna Smith",
  "file_path": "/Shared/Documents/testdoc.docx",
  "group_id": "628ceb16-b9a0-49f8-a0e4-72b729708f71"
}

Delete Comment

Delete a specific comment.

Request

DELETE /pubapi/v1/notes/{uuid}

Path Parameters

ParameterTypeRequiredDescription
uuidstringYesThe unique identifier for the comment to delete

Example Request

curl -i -X DELETE "https://{domain}.egnyte.com/pubapi/v1/notes/a7a809d3-1c2f-4dd0-8b65-3f2c78eac4c8" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response

200 OK

The comment was successfully deleted. No response body is returned.


Error Codes

StatusErrorDescriptionResolution
400Bad RequestUnparsable JSON in request bodyVerify JSON syntax is valid
400Bad RequestUnsupported JSON property in requestOnly include path and body fields when adding a comment
401UnauthorizedInvalid or expired tokenRefresh your OAuth token and ensure you are logged in
403ForbiddenInsufficient permissions on the file or folderVerify you have read/write access to the resource
404Not FoundComment does not existVerify the comment UUID is correct
500Internal Server ErrorUnexpected server errorRetry the request after a brief delay

Code Examples

POST /pubapi/v1/notes/{comment_id}

curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/notes/{comment_id}" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -d '{
  "path": "/Shared/Documents/form.docx",
  "body": "Test comment"
}'

GET /pubapi/v1/notes/{comment_id}?file=%2FShared%2FDocuments%2Fform.docx

curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/notes/{comment_id}?file=%2FShared%2FDocuments%2Fform.docx" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

GET /pubapi/v1/notes/{comment_id}

curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/notes/{comment_id}" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

DELETE /pubapi/v1/notes/{comment_id}

curl -i -X DELETE "https://{domain}.egnyte.com/pubapi/v1/notes/{comment_id}" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Reference →Browse all endpoints