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/"
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/public/articles/:id/");
xhr.send(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/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 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"))
Response
{
"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
}