Skip to content

The REST API

The JamComments REST API allows you to access your comments by HTTP request. Currently, only one endpoint is supported. The host for making API requests is https://go.jamcomments.com.

Retrieving Comments

Use this endpoint to retrieve a paginated list of comments for a page or entire site. Only approved comments will be fetched.

Method & URL

GET /api/comments

Request Headers

HeaderDescription
AuthorizationBearer 12345-YOUR-API-TOKEN
(You can create one for your account in the JamComments admin.

Query Parameters

ParameterRequired?Description
domainYesThe domain of the site.
pathNoThe page path for the comments you’re like to retrieve. If left blank, all comments for the given domain will be fetched.
per_pageNoThe number of top-level comments to be returned per page. The default is 50.

Response Body

The response body will be a JSON string containing a paginated list of comments, along with information about future pages (if needed).

Example Request

fetch(
"http://go.jamcomments.com/api/comments?domain=macarthur.me&path=/posts/dynamic-routing",
{
headers: {
Authorization: "Bearer 1234BLAHBLAHBLAH",
},
},
)
.then((response) => response.json())
.then((result) => console.log(result));

Example Response

{
"data": [
{
"created_at": "2023-11-26T06:30:07.000000Z",
"content": "This is some example content.",
"html": "<p>This is some example content.</p>\n",
"status": "approved",
"name": "Milton Friedman",
"path": "/posts/capitalism-is-awesome",
"children": [
{
"created_at": "2023-11-26T06:30:07.000000Z",
"content": "Totally agree!",
"html": "<p>Totally agree!</p>\n",
"status": "approved",
"name": "Adam Smith",
"path": "/posts/capitalism-is-awesome"
}
]
}
],
"links": {
"first": "https://go.jamcomments.com/api/comments?page=1",
"last": "https://go.jamcomments.com/api/comments?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "&laquo; Previous",
"active": false
},
{
"url": "https://go.jamcomments.com/api/comments?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next &raquo;",
"active": false
}
],
"path": "https://go.jamcomments.com/api/comments",
"per_page": 50,
"to": 16,
"total": 16
}
}

Feedback?

If you have any feedback on this feature, or have other related requests, send me an email!