Comments are additional information that you can add to your resources. Comments can be added to provide context for any operation that was performed.
When you make an API call on any resource, for example, Subscriptions -> Change term end, you can add more context to that operation by calling the comments API as a follow up call.
Besides the user generated comments, Chargebee also generates "System" comments when a change for a resource happens at the backend. These comments are all read-only.
Sample comment [ JSON ]
{
"added_by": "full_access_key_v1",
"created_at": 1517505963,
"entity_id": "__test__KyVnHhSBWm65N2rx",
"entity_type": "subscription",
"id": "cmt___test__KyVnHhSBWm69N2s4",
"notes": "This is a test comment",
"object": "comment",
"type": "user"
}
API Index URL GET
https://{site}.chargebee.com/api/v2/comments
Comment attributes
id
string, max chars=40 Unique identifier for the comment.
entity_type
enumerated string Type of the entity this comment generated for
Possible values are
customerEntity that represents a customer.subscriptionEntity that represents a subscription of a customer.invoiceInvoice description.quoteEntity that represents a quote.
credit_noteCredit note description.transactionEntity that represents a transaction.planEntity that represents a subscription plan.addonEntity that represents an addon.couponEntity that represents a discount coupon.orderEntity that represents an order.business_entityEntity that represents item of type business entity.item_familyEntity that represents item family.itemEntity that represents item.item_priceEntity that represents item price.productEntity that represents product.variantEntity that represents product variants.
Create a new comment for an entity. The newly added comment will be shown in the web interface as well.
Sample Request
curl https://{site}.chargebee.com/api/v2/comments \
-u {site_api_key}:\
-d entity_id="__test__KyVnHhSBWm65N2rx" \
-d entity_type="subscription" \
-d notes="This is a test comment"
copy
curl https://{site}.chargebee.com/api/v2/comments \
-u {site_api_key}:\
-d entity_id="__test__KyVnHhSBWm65N2rx" \
-d entity_type="subscription" \
-d notes="This is a test comment"
Sample Response [ JSON ]
Show more...
{"comment": {
"added_by": "full_access_key_v1",
"created_at": 1517505963,
"entity_id": "__test__KyVnHhSBWm65N2rx",
"entity_type": "subscription",
"id": "cmt___test__KyVnHhSBWm69N2s4",
"notes": "This is a test comment",
"object": "comment",
"type": "user"
}}
URL Format POST
https://{site}.chargebee.com/api/v2/comments
Input Parameters
entity_type
required, enumerated string Type of the entity to create the comment for.
Possible values are
customerEntity that represents a customersubscriptionEntity that represents a subscription of a customerinvoiceInvoice descriptionquoteEntity that represents a quote
credit_noteCredit note descriptiontransactionEntity that represents a transaction.planEntity that represents a subscription planaddonEntity that represents an addoncouponEntity that represents a discount couponorderEntity that represents an orderbusiness_entityEntity that represents item of type business entityitem_familyEntity that represents item familyitemEntity that represents itemitem_priceEntity that represents item priceproductEntity that represents productvariantEntity that represents product variants
Retrieve the list of comments sorted by the recent ones on the top.
If you want to retrieve the list of comments for an entity, for example, subscription you can filter them by passing the entity type and unique identifier for that entity, for example, subscription ID.
optional, integer, default=10, min=1, max=100 The number of resources to be returned.
offset
optional, string, max chars=1000 Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set offset to the value of next_offset obtained in the previous iteration of the API call.
sort_by[<sort-order>]
optional, string filter Sorts based on the specified attribute. Supported attributes : created_at Supported sort-orders : asc, desc
Example →sort_by[asc] = "created_at" This will sort the result based on the 'created_at' attribute in ascending(earliest first) order.
optional, enumerated string Type of the entity this comment generated for.
Possible values are
customerEntity that represents a customersubscriptionEntity that represents a subscription of a customerinvoiceInvoice descriptionquoteEntity that represents a quote
credit_noteCredit note descriptiontransactionEntity that represents a transaction.planEntity that represents a subscription planaddonEntity that represents an addoncouponEntity that represents a discount couponorderEntity that represents an orderbusiness_entityEntity that represents item of type business entityitem_familyEntity that represents item familyitemEntity that represents itemitem_priceEntity that represents item priceproductEntity that represents productvariantEntity that represents product variants
always returned
Resource object representing comment
next_offset
optional, string, max chars=1000
This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter “offset”.