Get all sources
GET/api/v1/sources
- Bash
- Node
- Python
- Response
curl -X GET 'https://<my_api_endpoint>/api/v1/sources' \
-H "Authorization: Bearer $REINFER_TOKEN"
const request = require("request");
request.get(
{
url: "https://<my_api_endpoint>/api/v1/sources",
headers: {
Authorization: "Bearer " + process.env.REINFER_TOKEN,
},
},
function (error, response, json) {
// digest response
console.log(JSON.stringify(json, null, 2));
}
);
import json
import os
import requests
response = requests.get(
"https://<my_api_endpoint>/api/v1/sources",
headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
)
print(json.dumps(response.json(), indent=2, sort_keys=True))
{
"sources": [
{
"created_at": "2016-02-10T23:13:28.340295+00:00",
"description": "An optional long form description.",
"id": "18ba5ce699f8da1f",
"last_modified": "2016-02-10T23:13:28.340295+00:00",
"name": "example",
"owner": "<project>",
"sensitive_properties": [],
"should_translate": false,
"title": "An Example Source",
"updated_at": "2016-02-10T23:13:28.340295+00:00"
}
],
"status": "ok"
}
Get sources by project
GET/api/v1/sources/<project>
- Bash
- Node
- Python
- Response
curl -X GET 'https://<my_api_endpoint>/api/v1/sources/<project>' \
-H "Authorization: Bearer $REINFER_TOKEN"
const request = require("request");
request.get(
{
url: "https://<my_api_endpoint>/api/v1/sources/<project>",
headers: {
Authorization: "Bearer " + process.env.REINFER_TOKEN,
},
},
function (error, response, json) {
// digest response
console.log(JSON.stringify(json, null, 2));
}
);
import json
import os
import requests
response = requests.get(
"https://<my_api_endpoint>/api/v1/sources/<project>",
headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
)
print(json.dumps(response.json(), indent=2, sort_keys=True))
{
"sources": [
{
"created_at": "2016-02-10T23:13:28.340295+00:00",
"description": "An optional long form description.",
"id": "18ba5ce699f8da1f",
"last_modified": "2016-02-10T23:13:28.340295+00:00",
"name": "example",
"owner": "<project>",
"sensitive_properties": [],
"should_translate": false,
"title": "An Example Source",
"updated_at": "2016-02-10T23:13:28.340295+00:00"
}
],
"status": "ok"
}
Get a source by project and name
GET/api/v1/sources/<project>/<source_name>
- Bash
- Node
- Python
- Response
curl -X GET 'https://<my_api_endpoint>/api/v1/sources/<project>/example' \
-H "Authorization: Bearer $REINFER_TOKEN"
const request = require("request");
request.get(
{
url: "https://<my_api_endpoint>/api/v1/sources/<project>/example",
headers: {
Authorization: "Bearer " + process.env.REINFER_TOKEN,
},
},
function (error, response, json) {
// digest response
console.log(JSON.stringify(json, null, 2));
}
);
import json
import os
import requests
response = requests.get(
"https://<my_api_endpoint>/api/v1/sources/<project>/example",
headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
)
print(json.dumps(response.json(), indent=2, sort_keys=True))
{
"source": {
"created_at": "2016-02-10T23:13:28.340295+00:00",
"description": "An optional long form description.",
"id": "18ba5ce699f8da1f",
"last_modified": "2016-02-10T23:13:28.340295+00:00",
"name": "example",
"owner": "<project>",
"sensitive_properties": [],
"should_translate": false,
"title": "An Example Source",
"updated_at": "2016-02-10T23:13:28.340295+00:00"
},
"status": "ok"
}
Get a source by id
GET/api/v1/sources/id:<source_id>
- Bash
- Node
- Python
- Response
curl -X GET 'https://<my_api_endpoint>/api/v1/sources/id:18ba5ce699f8da1f' \
-H "Authorization: Bearer $REINFER_TOKEN"
const request = require("request");
request.get(
{
url: "https://<my_api_endpoint>/api/v1/sources/id:18ba5ce699f8da1f",
headers: {
Authorization: "Bearer " + process.env.REINFER_TOKEN,
},
},
function (error, response, json) {
// digest response
console.log(JSON.stringify(json, null, 2));
}
);
import json
import os
import requests
response = requests.get(
"https://<my_api_endpoint>/api/v1/sources/id:18ba5ce699f8da1f",
headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
)
print(json.dumps(response.json(), indent=2, sort_keys=True))
{
"source": {
"created_at": "2016-02-10T23:13:28.340295+00:00",
"description": "An optional long form description.",
"id": "18ba5ce699f8da1f",
"language": "en",
"last_modified": "2016-02-10T23:13:28.340295+00:00",
"name": "example",
"owner": "<project>",
"sensitive_properties": [],
"should_translate": false,
"title": "An Example Source",
"updated_at": "2016-02-10T23:13:28.340295+00:00"
},
"status": "ok"
}
Create a source
PUT/api/v1/sources/<project>/<source_name>
- Bash
- Node
- Python
- Response
curl -X PUT 'https://<my_api_endpoint>/api/v1/sources/<project>/example' \
-H "Authorization: Bearer $REINFER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"source": {
"description": "An optional long form description.",
"title": "An Example Source"
}
}'
const request = require("request");
request.put(
{
url: "https://<my_api_endpoint>/api/v1/sources/<project>/example",
headers: {
Authorization: "Bearer " + process.env.REINFER_TOKEN,
},
json: true,
body: {
source: {
description: "An optional long form description.",
title: "An Example Source",
},
},
},
function (error, response, json) {
// digest response
console.log(JSON.stringify(json, null, 2));
}
);
import json
import os
import requests
response = requests.put(
"https://<my_api_endpoint>/api/v1/sources/<project>/example",
headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
json={
"source": {
"title": "An Example Source",
"description": "An optional long form description.",
}
},
)
print(json.dumps(response.json(), indent=2, sort_keys=True))
{
"source": {
"created_at": "2016-02-10T23:13:28.340295+00:00",
"description": "An optional long form description.",
"id": "18ba5ce699f8da1f",
"language": "en",
"last_modified": "2016-02-10T23:13:28.340295+00:00",
"name": "example",
"owner": "<project>",
"sensitive_properties": [],
"should_translate": false,
"title": "An Example Source",
"updated_at": "2016-02-10T23:13:28.340295+00:00"
},
"status": "ok"
}
Name | Type | Required | Description |
---|---|---|---|
language | string | no | The primary language of the source. Supported values are en (English) and de (German). Defaults to en. |
title | string | no | One-line human-readable title for the source. |
description | string | no | A longer description of the source. |
should_translate | boolean | no | Whether verbatims uploaded to this source should be translated into the language where required. Defaults to false. |
sensitive_properties | array<string> | no | An array of properties which should be marked as sensitive and hidden from non-privileged users. |
bucket_id | string | no | ID of a bucket to load data from. Data will be parsed into comments and loaded into this source. |
Update a source
POST/api/v1/sources/<project>/<source_name>
- Bash
- Node
- Python
- Response
curl -X POST 'https://<my_api_endpoint>/api/v1/sources/<project>/example' \
-H "Authorization: Bearer $REINFER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"source": {
"description": "An alternative description."
}
}'
const request = require("request");
request.post(
{
url: "https://<my_api_endpoint>/api/v1/sources/<project>/example",
headers: {
Authorization: "Bearer " + process.env.REINFER_TOKEN,
},
json: true,
body: { source: { description: "An alternative description." } },
},
function (error, response, json) {
// digest response
console.log(JSON.stringify(json, null, 2));
}
);
import json
import os
import requests
response = requests.post(
"https://<my_api_endpoint>/api/v1/sources/<project>/example",
headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
json={"source": {"description": "An alternative description."}},
)
print(json.dumps(response.json(), indent=2, sort_keys=True))
{
"source": {
"created_at": "2016-02-10T23:13:28.340295+00:00",
"description": "An alternative description.",
"id": "18ba5ce699f8da1f",
"language": "en",
"last_modified": "2016-02-11T08:06:14.944290+00:00",
"name": "example",
"owner": "<project>",
"sensitive_properties": [],
"should_translate": false,
"title": "An Example Source",
"updated_at": "2016-02-11T08:06:14.944290+00:00"
},
"status": "ok"
}
Name | Type | Required | Description |
---|---|---|---|
title | string | no | One-line human-readable title for the source. |
description | string | no | A longer description of the source. |
should_translate | boolean | no | Whether verbatims uploaded to this source should be translated into English where required. Defaults to false. |
sensitive_properties | array<string> | no | An array of properties which should be marked as sensitive and hidden from non-privileged users. |
bucket_id | string | no | ID of a bucket to load data from. Data will be parsed into comments and loaded into this source. |
Delete a source
DELETE/api/v1/sources/id:<source_id>
- Bash
- Node
- Python
- Response
curl -X DELETE 'https://<my_api_endpoint>/api/v1/sources/id:18ba5ce699f8da1f' \
-H "Authorization: Bearer $REINFER_TOKEN"
const request = require("request");
request.delete(
{
url: "https://<my_api_endpoint>/api/v1/sources/id:18ba5ce699f8da1f",
headers: {
Authorization: "Bearer " + process.env.REINFER_TOKEN,
},
},
function (error, response, json) {
// digest response
console.log(JSON.stringify(json, null, 2));
}
);
import json
import os
import requests
response = requests.delete(
"https://<my_api_endpoint>/api/v1/sources/id:18ba5ce699f8da1f",
headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
)
print(json.dumps(response.json(), indent=2, sort_keys=True))
{
"status": "ok"
}