/{category-id}
Represents a Knowledge Library category. The /{category-id}
node returns a single category.
You can read information about a category by making a Graph API GET
request to /{category-id}
.
Reading Categorynode require Read Knowledge Library content permission.
Field Name | Description | Data Type |
---|---|---|
|
The category ID |
|
|
The title of the category |
|
|
The text content of the category's document |
|
|
Indicates the status of the category |
|
|
The last member to edit the content. |
|
|
Users/Groups/Conditional access based on profile fields to read the content in the category. |
|
|
The color of the category. |
|
|
The icon representing the category. |
|
|
The time when the category was last updated. |
|
|
The formatted content of category in JSON. |
|
|
ID of parent category. Null/empty if category is a root category. |
|
|
Sequence number of the category in the parent's hierarchy. |
|
You can't publish using this node. To make a new category in a community, use the /community/knowledge_library_categories
edge as described here
.
A category can be deleted by making a DELETE
request to /{category_id}
. You will need Manage Knowledge Library content
permission.
A category can be updated by making a POST
request on the /{category_id}
. You will need Manage Knowledge Library content
permission.
/subcategories
All subcategories associated with a category. Use this edge to get the list of subcategories or to create a new subcategory.
/photos
Add a new photo to a category. It supports the following format:
File Size:
/videos
Add a new video to a category. It supports the following format: MP4
/files
Add a new file to a category
/comments
The comments on a category.Supports a summary
field to get a total count.
/reactions
The Members
who have reacted to this post. It supports
summary
field to get a total count.since
and until
fields to get the number of reactions within a given time frame. /seen
The Members
who have seen this post.It supports
summary
field to get a total count.since
and until
fields to get the number of reactions within a given time frame.Note that this is subject to the same limitations as described here
title
, icon
, color
, json_content
of a category GET /{category_id}?fields=title,icon,color,json_content HTTP/1.1
Host: graph.facebook.com
POST /{category_id}/subcategories?
title={...} &
json_content={...}
icon ={...}
HTTP/1.1
Host: graph.facebook.com
audience
of a category, including details on whether it was shared with groups, specific users or based on profile set conditions GET /{category_id}?
fields=read_audience
{audience_type,
groups,
static_users,
profile_set_conditions}
HTTP/1.1
Host: graph.facebook.com
audience
of a category POST /{category_id} HTTP/1.1
Host: graph.facebook.com
Payload: //Example 1: { "read_audience": { "audience_type": "PROFILE_FIELDS", "profile_set_conditions": [ { "field": "LOCATION", "operator": "CONTAINS", "values": [ "London", "San Francisco" ] }, { "field": "TITLE", "operator": "CONTAINS", "values": [ "Engineer" ] } ] } } //Example 2: { "read_audience": { "audience_type": "GROUPS", "groups": [{group_id_1},{group_id_2}] } } //Example 3: //Only for subcategories to inherit the parent category's audience { "read_audience": { "audience_type": "INHERIT" } }
POST graph.facebook.com
/{category-id}/photos?url={image-url}
POST graph.facebook.com
/{category-id}/videos?url={video-url}
POST graph.facebook.com
/{category-id}/files?url={file-url}&name={file_name}
The response payload after uploading photo/video/file will return an id
that can be used in json_content for the root type image/video/resource_section respectively as described in the next section.
Get /{category_id}/comments?
summary=true
HTTP/1.1
Host: graph.facebook.com
Get /{category_id}/reactions?
summary=true&
since={unix_timestamp}&
until={unix_timestamp}
HTTP/1.1
Host: graph.facebook.com
DELETE /{category_id} HTTP/1.1
Host: graph.facebook.com
This would remove the category from Knowledge Library.
json_content
{ "json_content": [ { "type": {root_type}, } ], }
json_content[]
Property | Type | Description |
---|---|---|
|
String |
The root type should be either |
|
Object[] |
Array of nodes Only applicable for |
|
Object |
Details of the image such as Only applicable for |
|
ENUM {left,right,center} |
Horizontal alignment of the image. Only applicable for |
|
Integer |
Width of the image. Only applicable for |
|
Object |
Details of the video such as Only applicable for |
|
Boolean |
Flag indicating if the video is a gif Only applicable for |
|
String |
Name of the section Only applicable for |
|
URL |
Video url from supported websites, including: Workplace, Facebook, Vimeo and Youtube. Only applicable for |
{ "type": "text_block", "children": [ { "type": "h1", "children": [ { "type": "text", "text": "Header 1" } ] }, { "type": "p", "children": [ { "type": "text", "text": "This is a paragraph" } ] }, ] }
{ "type": "image", "image_data": { "id": {image_id} }, "image_width": 440, "halign": "center" }
{ "type": "video", "video_data": { "id": {video_id} }, "is_gif": false }
{ "type": "resource_section", "name": {section_name}, "children": [{ "type": "resource_file", "file_data": { "id": {file_id} }, "name": {file_name}, "description": {file_description} }, { "type": "resource_link", "href": {file_url}, "name": {file_name}, "description": {file_description} } ] }}
{ "type": "embedded_media", "url": {url} }
json_content[].children[]
type
String
Possible child type for:
h1
, h2
, ol
, p
, code
, ul
resource_file
, resource_link
children
Object[]
Array of child nodes as described in the next table
h1
Possible children: mention
, b
, u
, s
, i
, a
, text
h2
Possible children: mention
, b
, u
, s
, i
, a
, text
ol
li
p
Defines a paragraph
Possible children: mention
, b
, u
, s
, i
, a
, text
code
code
Possible children: mention
, b
, u
, s
, i
, a
, text
ul
li
mention
Mention a Member
Along with this type the other fields present are created by
and entity
(Workplace Member)
Possible children: b
, u
, s
, i
, a
, text
b
Bold
Possible children: mention
, u
, s
, i
, a
, text
u
Possible children: mention
, b
, s
, i
, a
, text
s
Possible children: mention
, b
, u
, i
, a
, text
i
Possible children: mention
, b
, u
, s
, a
, text
a
Possible children: b
, u
, s
, i
, text
text
Text
This is the ultimate child of all child types when the root type is text_block and is of type string
resource_file
Object
Details of the resource file within a resource_section such as name
, description
and file_data
(containing file_id
)
resource_link
Object
Details of the resource link within resource_section such as name
, description
and href
{ "type": "mention", "children": [{ "type": "text", "text": "Mentioned Member" }], "created_by": { "id":{creator_member_id}, "name": "Creator Member" }, "entity": { "id": {mentioned_member_id}, "name": "Mentioned Member" } }
{ "type": "p", "children": [{ "type": "b", "children": [{ "type": "i", "children": [{ "type": "u", "children": [{ "type": "text", "text": "Example Content which is Bold, Italics & Underlined" }] }] }] }] }
{ "type": "ol", "children": [{ "type": "li", "children": [{ "type": "text", "text": "Item 1" }] }, { "type": "li", "children": [{ "type": "text", "text": "Item 2" }] } ] }
{ "type": "code", "children": [{ "type": "b", "children": [{ "type": "text", "text": "console.log(\"Bold\")" }] }] }
{ "type": "a", "children": [{ "type": "text", "text": {link_text} }], "href": {url} }