Get article
Return information about single article.
GET
/api/articles/:id/
curl -X GET "https://<your_app_subdomain>.user.com/api/articles/:id/"
Response
{
"author": {
"avatar": "http://dev.user.localhost/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
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://<your_app_subdomain>.user.com/api/articles/:id/",
"method": "GET"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var data = null;
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://<your_app_subdomain>.user.com/api/articles/:id/");
xhr.send(data);
var request = require("request");
var options = { method: 'GET',
url: 'https://<your_app_subdomain>.user.com/api/articles/:id/' };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/articles/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => ""
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://<your_app_subdomain>.user.com/api/articles/:id/"
response = requests.request("GET", url)
print(response.text)
import http.client
conn = http.client.HTTPSConnection("<your_app_subdomain>.user.com")
conn.request("GET", "/api/articles/:id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))