Skip to main content

 

 

Coupa Success Portal

Comments API

The URL to access contract terms is: https://<instance>/api/comments

Example: POST Call

<comment>
   <commentable-id type="integer">123456</commentable-id>
   <commentable-type>InvoiceHeader</commentable-type>
   <comments>COMMENT TEXT</comments>
</comment>

Actions

To GET or POST comments, use the API for the object you’d like to pull data for, and add /comments to the end of the url; it should look like this:
/api/{transactional_object}/{object_id}/comments.

Using the GET call gets all comments for the document, where the POST call adds a new comment.

Comments can also be added by using /api/comments, where a payload is required to GET or POST properly.

The Comments API allows you to:

Verb Path Action Description
POST /api/invoices/:invoice_id/comments create Create comment
POST /api/expense_reports/:expense_report_id/comments create Create comment
POST /api/purchase_orders/:purchase_order_id/comments create Create comment
POST /api/users/:user_id/comments create Create comment
POST /api/requisitions/:requisition_id/comments create Create comment
GET /api/invoices/:invoice_id/comments index Query comments
GET /api/expense_reports/:expense_report_id/comments index Query comments
GET /api/purchase_orders/:purchase_order_id/comments index Query comments
GET /api/users/:user_id/comments index Query comments
GET /api/requisitions/:requisition_id/comments index Query comments
GET /api/invoices/:invoice_id/comments/:id show Show comment
GET /api/expense_reports/:expense_report_id/comments/:id show Show comment
GET /api/purchase_orders/:purchase_order_id/comments/:id show Show comment
GET /api/users/:user_id/comments/:id show Show comment
GET /api/requisitions/:requisition_id/comments/:id show Show comment
PATCH /api/invoices/:invoice_id/comments/:id update Update comment
PUT /api/invoices/:invoice_id/comments/:id update Update comment
PATCH /api/expense_reports/:expense_report_id/comments/:id update Update comment
PUT /api/expense_reports/:expense_report_id/comments/:id update Update comment
PATCH /api/purchase_orders/:purchase_order_id/comments/:id update Update comment
PUT /api/purchase_orders/:purchase_order_id/comments/:id update Update comment
PATCH /api/users/:user_id/comments/:id update Update comment
PUT /api/users/:user_id/comments/:id update Update comment
PATCH /api/requisitions/:requisition_id/comments/:id update Update comment
PUT /api/requisitions/:requisition_id/comments/:id update Update comment

Elements

The following elements are available for the Comments API:

Element Description Required Field? Unique? Allowable Value Api_In Field? Api_Out Field? Data Type
commentable-id commentable_id       yes yes integer
commentable-type commentable_type       yes yes string(255)
comments The comment you want to post. You can mention a user by including @[User:{id}] as part of the comment field.       yes yes text
created-at Automatically created by Coupa in the format YYYY-MM-DDTHH:MM:SS+HH:MMZ         yes datetime
created-by User who created the comment.         yes User   
id Coupa's unique identifier for the comment.         yes integer

It is also possible to mention a specific user in a comment posted via the API, this will notify the user that they have been mentioned in the comment, provided that they have document mentions notifications turned on.  When mentioning a user in a comment via the API refer to them via their user's technical ID, for example, to mention the user with technical ID 2 - include "@[User:2] " in the comment text, like this:

<comment>
   <commentable-id type="integer">123456</commentable-id>
   <commentable-type>InvoiceHeader</commentable-type>
   <comments>@[User:2] please see this comment</comments>
</comment>

You can read more about mentions in comments here

  • Was this article helpful?