Documentation
API
Discussion API
The Discussion API is composed of 4 endpoints:
- List Discussions — list the discussions and attached comments on a project
- Delete Discussion — delete a discussion
- Lock Discussion - lock a discussion
- Unlock Discussion - unlock a discussion
List Discussions
This endpoint is accessible by both read-write and read-only Project API keys and returns the discussions on a project.
/api/projects/:project_token/discussions [GET]
Pagination
This resource is paginated and serves 250 Discussions per page. You can specify further page using the ?page parameter. Note that page numbering is 1-based and that omitting the ?page parameter will return the first page.
Link Header
The pagination information is included in the Link header. You can use the Link Header in order to know which page is next and which page is the last one, instead of constructing your own URLs.
For instance, let’s make a curl request to the TermBase API:
$ curl -I "https://webtranslateit.com/api/projects/api_token/discussions.json"
The -I parameter indicates that we only care about the headers, not the actual content. In examining the result, you’ll notice some information in the Link header that looks like this:
Link: <https://webtranslateit.com/api/projects/api_key/discussions.json?page=2>; rel="next",
<https://webtranslateit.com/api/projects/api_key/discussions.json?page=20>; rel="last"
The possible rel values are:
next: Shows the URL of the immediate next page of results.last: Shows the URL of the last page of results.first: Shows the URL of the first page of results.prev: Shows the URL of the immediate previous page of results.
Here’s another example of the Link Header when browsing the 3rd page:
$ curl -I "https://webtranslateit.com/api/projects/api_token/discussions.json?page=3"
Link: <https://webtranslateit.com/api/projects/api_key/discussions.json?page=4>; rel="next",
<https://webtranslateit.com/api/projects/api_key/discussions.json?page=9>; rel="last",
<https://webtranslateit.com/api/projects/api_key/discussions.json?page=1>; rel="first",
<https://webtranslateit.com/api/projects/api_key/discussions.json?page=2>; rel="prev"
This resource is paginated and serves 250 Discussions per page. In the server response headers, you will find Link, with a link for an API call to the next and last pages.
Optional Parameters:
string_id: ID of a segmentlocale: the locale of the discussion:en-US,en_GBorfrfor instance.kind: can besegmentsto list discussions about segments only orprojectto list discussions about projects only.status: can belockedor left blank.page: the page number
Example query:
https://webtranslateit.com/api/projects/api_key/discussions.json
Example response with JSON:
The author’s e-mail address is anonymized when authenticating using the read-only API token. E-mail address is visible when authenticating using the read-write API token.
[
{
"id": 35609,
"kind": "project",
"resource_id": 406,
"created_at": "2014-07-04T09:30:07Z",
"updated_at": "2014-07-04T09:30:07Z",
"author": {
"name": "Édouard Brière",
"email": ""
},
"last_author": {
"name": "Édouard Brière",
"email": ""
},
"topic": "A discussion with attachments",
"status": "open",
"comments": [
{
"id": 83636,
"created_at": "2014-07-04T09:30:07Z",
"author": {
"name": "Édouard Brière",
"email": ""
},
"text": "This is comment 1",
"file_attachments": [
{
"id": 5636,
"created_at": "2014-07-04T09:30:01Z",
"url": "https://s3.amazonaws.com/users0-webtranslateit/development/file_attachments/original/5636_c56d2833ca71dedd18c200e545136e2589310fdd.png?1404466201"
}
]
},
{
"id": 83637,
"created_at": "2014-07-04T09:30:20Z",
"author": {
"name": "Édouard Brière",
"email": ""
},
"text": "Comment 2",
"file_attachments": []
}
]
},
{
"id": 15577,
"kind": "segment",
"resource_id": 772340,
"created_at": "2012-02-14T11:43:11Z",
"updated_at": "2012-03-09T08:35:56Z",
"author": {
"name": "Estelle Alexandre",
"email": ""
},
"last_author": {
"name": "Estelle Alexandre",
"email": ""
},
"topic": null,
"status": "open",
"comments": [
{
"id": 42420,
"created_at": "2012-02-14T11:43:11Z",
"author": {
"name": "Estelle Alexandre",
"email": ""
},
"text": "