Get post
Method | Domain | Path | Description |
---|---|---|---|
GET | LuaChad | /post/$board_abbreviation |
get all posts of a board |
Example output
[
{
"height": 25,
"board": "c",
"contents": [
{
"length": 22,
"is_embeded": true,
"id": 1,
"content": "pinned",
"type": "text/plain"
}
],
"rank": 1000
},
{
"height": 37,
"board": "c",
"janny": {
"profile": {
"name": "hi1",
"id": "2724a7f4f84f78d51a1ecf3a121b7380",
"email": "[email protected]"
},
"permissions": [
"add:board",
"ban:ip",
"delete:post",
"nocaptcha",
"set:rank",
"unban:ip"
]
},
"contents": [
{
"id": 2,
"length": 100,
"content": "{\n \"command\":\"set:rank\",\n \"board\":\"c\",\n \"height\":28,\n \"new_rank\":1000,\n \"is_a\":true\n}",
"exec_status": "err",
"is_embeded": true,
"type": "application/4chad.jannyscript"
},
{
"length": 22,
"is_embeded": true,
"id": 1,
"content": "christ is the only way",
"type": "text/plain"
}
],
"rank": 37
},
{
"children_preview": [
{
"created_at": 1592198022,
"parent": 2,
"height": 4,
"board": "c",
"password_hash": "klUfY5jSmyC7HAXnBVciqUzeobEVWKRSYW/AHiJfmciZ9RnZjEcOD7DLDqtLI+De",
"contents": [
{
"length": 5,
"is_embeded": true,
"id": 1,
"content": "hello",
"type": "text/plain"
}
],
"content_count": 1
},
{
"created_at": 1592197982,
"parent": 2,
"height": 3,
"board": "c",
"password_hash": "klUfY5jSmyC7HAXnBVciqUzeobEVWKRSYW/AHiJfmciZ9RnZjEcOD7DLDqtLI+De",
"contents": [
{
"length": 5,
"is_embeded": true,
"id": 1,
"content": "hello",
"type": "text/plain"
}
],
"content_count": 1
}
],
"rank": 4,
"height": 2,
"board": "c",
"janny": {
"profile": {
"name": "hi1",
"id": "2724a7f4f84f78d5",
"email": "[email protected]"
},
"permissions": [
"add:board",
"ban:ip",
"delete:post",
"nocaptcha",
"set:rank",
"unban:ip"
]
},
"contents": [
{
"length": 24,
"is_embeded": true,
"id": 1,
"content": "pinneddddddddddddddddddd",
"type": "text/plain"
}
],
"children_count": 2
}
]
Notice if a post has children, there would be a children_count
, and children_preview
, the children_preview
is limited to a few posts, if you want to view the full children:
Method | Domain | Path | Description |
---|---|---|---|
GET | LuaChad | $base_url/$board_abbreviation/$post_height/children |
get all children of a parent thread |
Response example:
[
{
"created_at": 1592197982,
"parent": "2",
"height": 3,
"board": "c",
"password_hash": "klUfY5jSmyC7HAXnBVciqUzeobEVWKRSYW/AHiJfmciZ9RnZjEcOD7DLDqtLI+De",
"contents": [
{
"length": 5,
"is_embeded": true,
"id": 1,
"content": "hello",
"type": "text/plain"
}
],
"content_count": 1
},
{
"created_at": 1592198022,
"parent": "2",
"height": 4,
"board": "c",
"password_hash": "klUfY5jSmyC7HAXnBVciqUzeobEVWKRSYW/AHiJfmciZ9RnZjEcOD7DLDqtLI+De",
"contents": [
{
"length": 5,
"is_embeded": true,
"id": 1,
"content": "hello",
"type": "text/plain"
}
],
"content_count": 1
}
]
If you want to get a single post, you know what to do, I’m not going to mention it here because it’s uncached and unnecessary in the normal browsing flow, but I open that endpoint anyways because whatever dude, it’s not that big of a problem for me, but if the sites hits performance issues because some retard developer is querying one post at a time, I’ll SHUT IT DOWN.
/a
is hard coded to display all the posts
Method | Domain | Path | Description |
---|---|---|---|
GET | LuaChad | /post/a |
get all posts on 4Chad |
[
{
"rank": 1592059681,
"board": "c",
"contents": [
{
"length": 22,
"is_embeded": true,
"id": 1,
"content": "pinned",
"type": "text/plain"
}
],
"height": 37
},
{
"rank": 1592059679,
"board": "c",
"janny": {
"profile": {
"name": "hi1",
"id": "2724a7f4f84f78d51a1ecf3a121b7380",
"email": "[email protected]"
},
"permissions": [
"add:board",
"ban:ip",
"delete:post",
"nocaptcha",
"set:rank",
"unban:ip"
]
},
"contents": [
{
"id": 2,
"length": 100,
"content": "{\n \"command\":\"set:rank\",\n \"board\":\"c\",\n \"height\":28,\n \"new_rank\":1000,\n \"is_a\":true\n}",
"exec_status": "err",
"is_embeded": true,
"type": "application/4chad.jannyscript"
},
{
"length": 22,
"is_embeded": true,
"id": 1,
"content": "christ is the only way",
"type": "text/plain"
}
],
"height": 36
}
]
Ranking is latest gets rank as high as height, higher rank number means higher rank, or janny pins post by changing its rank quite high.
The result may be unsorted, sort the array on your end according to post rank, then display it. So don’t call me glowie when it’s your fault treating unsorted array as sorted.
Add post
Method | Domain | Path | Description |
---|---|---|---|
POST | LuaChad | /post/$board_abbreviation |
add a post to 4Chad |
Example body:
{
"board":"c",
"parentt":1,
"preclaims": [
{
"id": 1,
"type": "text/plain",
"content":"pinneddddddddddddddddddd",
"is_embeded":true
},
{
"id":2,
"type":"application/4chad.jannyscript",
"is_embeded":true,
"content":"{\n \"command\":\"set:rank\",\n \"board\":\"c\",\n \"height\":28,\n \"new_rank\":1000,\n \"is_a\":true\n}"
}
],
"password_hash":"klUfY5jSmyC7HAXnBVciqUzeobEVWKRSYW/AHiJfmciZ9RnZjEcOD7DLDqtLI+De"
}
Response example
{
"board": "c",
"upload_tokens": {},
"status": "ok",
"height": 2
}
To upload posts along with large content(>4kB)
{
"board":"c",
"parentt":1,
"preclaims": [
{
"id": 1,
"type": "text/plain",
"content":"ooooooooooooooooooooooooo",
"is_embeded":true
},
{
"id":2,
"type":"application/pdf",
"length": 123456
}
],
"password_hash":"klUfY5jSmyC7HAXnBVciqUzeobEVWKRSYW/AHiJfmciZ9RnZjEcOD7DLDqtLI+De"
}
Response example:
{
"board": "c",
"upload_tokens": [
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJib2FyZCI6ImMiLCJleHAiOjE1OTIxMzEzMTAsImNvbnRlbnQiOnsiaWQiOjIsInR5cGUiOiJhcHBsaWNhdGlvblwvcGRmIiwibGVuZ3RoIjoxMjM0NTZ9LCJoZWlnaHQiOjF9.Gw5d8WMhbeqwBV6c41BYe1C59G2UBd98DWhbObzJFuk",
"id": 2
}
],
"status": "ok",
"height": 1
}
Now that you have the token, take it to the content endpoint