Lucky Book Searching Function
Searches lucky book content by number.
| Method | GET |
| Path | /api/v1/newsearch/{language}/{type}/{search} |
| Full URL | https://backend.4dnum.com/api/v1/newsearch/{language}/{type}/{search} |
Request
| Attribute | Type | Mandatory | Example | Description |
|---|---|---|---|---|
language | String | Yes | en | en = English, cn = Chinese, my = Malay. |
type | String | Yes | all | Which lucky book(s) to search. See table below. |
search | String | Yes | 020 | The number entered by the user. |
type values
| Value | Returns |
|---|---|
all | gzt, wzt and qzt |
gzt | Guan Yin Ma Dictionary only |
qzt | Tua Pek Kong (Qian) Dictionary only |
wzt | Tua Pek Kong (Wan) Dictionary only |
Response
| Attribute | Type | Example | Description |
|---|---|---|---|
data.number | String | 0020 | Lucky book number. |
data.content | String | DEAD COW | Meaning of the number. |
data.image | String | https://backend.4dnum.com/image.png | Image for that number. |
data.cat | String | wzt | Which lucky book the entry came from. |
note
The source document prints this last field as date.cat. It is a typo for
data.cat — the entries all sit under data.
Example
curl https://backend.4dnum.com/api/v1/newsearch/en/all/020
{
"data": [
{
"number": "0020",
"content": "DEAD COW",
"image": "https://backend.4dnum.com/image.png",
"cat": "wzt"
}
]
}
// Group an `all` search by dictionary
const {data} = await get('/newsearch/en/all/020');
const byBook = data.reduce((acc, e) => {
(acc[e.cat] ||= []).push(e);
return acc;
}, {});
caution
number is zero-padded here too, and to a different width than
Lucky Book Content — 0020 versus 020. Do not
assume a fixed length when matching.