GET/ articles/ :id/
Get article
You can return details about a specific attribute.
Request
- cURL
- JavaScript
- PHP
- Python
curl -X GET "https://<your_app_subdomain>.user.com/api/public/articles/:id/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2"
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/articles/:id/",
{
method: "GET",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
},
},
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/articles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.get(
"https://<your_app_subdomain>.user.com/api/public/articles/:id/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
)
print(response.json())
Response examples
- 200 OK
- 404 Not Found
{"author": {"avatar": "https://<your_app_subdomain>.user.com/static/img/agent.svg","id": 1,"name": "developer developer"},"categories": [],"content": "test","created_at": "2020-12-04T13:41:46.540889Z","id": 1,"intro_text": "test","language": "en","rating": "4.00","slug": "test","tags": [],"title": "Test","translations": [{"id": 1,"is_default": true,"label": "English","language": "en","status": 0}],"updated_at": "2020-12-04T13:41:46.620162Z","url": "/knowledge-base/test/","views": 1}{
"detail": "No TutorArticle matches the given query."
}
Response fields
Fields returned in the 200 OK response body.
- id
- ID of the article.
- title
- A title of a web push message.
- slug
- URL slug of the article's default translation.
- content
- A content of a message sent to the user.
- author
- A unique identifier of an agent who created a global variable. A visible author.
- author.
id - ID of the agent who wrote the article.
- author.
name - Full name of the agent who wrote the article.
- author.
avatar - URL of the author's avatar; the app's default avatar if the agent has none.
- author.
- url
- A URL of a web push message.
- intro_text
- Intro text of the article in the requested language.
- categories
- A list of categories' ids.
- views
- Number of times the article was viewed.
- created_at
- When the article was created, ISO 8601.
- updated_at
- When the article was last updated, ISO 8601.
- rating
- Average reader rating from
1to5, as a string with two decimal places;nullif nobody has rated the article. - translations
- Language versions of the article.
- translations[].
id - ID of the translation.
- translations[].
language - ISO 639-1 code of the language.
- translations[].
is_default - Whether this is the article's default translation.
- translations[].
status - Publication status of the translation:
0draft,1ready to publish,2published or3archived. - translations[].
label - Name of the translation's language, in English.
- translations[].
- language
- ISO 639-1 code of the language.
- tags
- Names of the article's tags.
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.