記事の一覧を取得する
GraphQLクエリー
query getArticles(
$bookUid: ID!
$q: String
$categoryUid: ID
$orderBy: String = "createdAt"
$first: Int
$offset: Int
) {
node(id: $bookUid) {
... on Book {
__typename
name
articles(
first: $first
offset: $offset
q: $q
categoryUid: $categoryUid
orderBy: $orderBy
) {
totalCount
nodes {
uid
name
slug
id
bodyText
createdAt
updatedAt
}
}
}
}
}パラメーター
パラメーター名 | 必須 | 説明 |
|---|---|---|
bookUid | 必須 | ブックのUID |
q | 記事の名称(一部でも可) | |
categoryUid | カテゴリーのUID | |
orderBy | 並び順 | |
first | 必須 | 何件取得するか |
offset | 先頭からのオフセット |
GraphQLレスポンス
項目名 | 説明 |
|---|---|
name | ブックの名称 |
articles.nodes.uid | 記事のUID |
articles.nodes.name | 記事の名称 |
articles.nodes.slug | 記事のスラグ |
articles.nodes.id | 記事の連番 |
articles.nodes.bodyText | 記事の本文(テキスト形式) |
articles.nodes.bodySnippet | 記事のスニペット ※50件以上を取得する場合は |
articles.nodes.createdAt | 作成日時 |
articles.nodes.updatedAt | 更新日時 |
レスポンスの例
{
"data": {
"node": {
"__typename": "Book",
"name": "テスト文書",
"articles": {
"totalCount": 14,
"nodes": [
{
"uid": "ar_19v11ggwwaq242pn18dsk47duz",
"name": "Runbookについて",
"slug": "test-article",
"id": "14",
"bodyText": "テキストテキスト",
"createdAt": "2024-11-26T10:06:59+09:00",
"updatedAt": "2024-11-26T15:18:43+09:00"
},
...
]
}
}
}
}最終更新: