文章详情
curl --request GET \
--url https://api.example.com/content/article/{id}import requests
url = "https://api.example.com/content/article/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/content/article/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/content/article/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/content/article/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/content/article/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/content/article/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "ok",
"data": {
"id": 1,
"source": null,
"source_avatar": null,
"title": "欢迎使用 duxcms 内容管理系统",
"keywords": null,
"descriptions": "duxcms 是一款简单、易用强大的内容管理系统。",
"content": "<div class=\"typo\" style=\"font-size: 18px; line-height: 1.8em; letter-spacing: .1em;\"><p style=\"margin: 1.5em 5px;\">duxcms 是一款简单、易用强大的内容管理系统。</p></div>",
"images": [],
"view": 1,
"time": "2023-12-14 15:18:32",
"collect": 0,
"comment": 0,
"praise": 0,
"extend": null
},
"meta": []
}文章接口
文章详情
GET
/
content
/
article
/
{id}
文章详情
curl --request GET \
--url https://api.example.com/content/article/{id}import requests
url = "https://api.example.com/content/article/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/content/article/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/content/article/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/content/article/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/content/article/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/content/article/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "ok",
"data": {
"id": 1,
"source": null,
"source_avatar": null,
"title": "欢迎使用 duxcms 内容管理系统",
"keywords": null,
"descriptions": "duxcms 是一款简单、易用强大的内容管理系统。",
"content": "<div class=\"typo\" style=\"font-size: 18px; line-height: 1.8em; letter-spacing: .1em;\"><p style=\"margin: 1.5em 5px;\">duxcms 是一款简单、易用强大的内容管理系统。</p></div>",
"images": [],
"view": 1,
"time": "2023-12-14 15:18:32",
"collect": 0,
"comment": 0,
"praise": 0,
"extend": null
},
"meta": []
}⌘I