Skip to main content

Lucky Book Searching Function

Searches lucky book content by number.

MethodGET
Path/api/v1/newsearch/{language}/{type}/{search}
Full URLhttps://backend.4dnum.com/api/v1/newsearch/{language}/{type}/{search}

Request​

AttributeTypeMandatoryExampleDescription
languageStringYesenen = English, cn = Chinese, my = Malay.
typeStringYesallWhich lucky book(s) to search. See table below.
searchStringYes020The number entered by the user.

type values​

ValueReturns
allgzt, wzt and qzt
gztGuan Yin Ma Dictionary only
qztTua Pek Kong (Qian) Dictionary only
wztTua Pek Kong (Wan) Dictionary only

Response​

AttributeTypeExampleDescription
data.numberString0020Lucky book number.
data.contentStringDEAD COWMeaning of the number.
data.imageStringhttps://backend.4dnum.com/image.pngImage for that number.
data.catStringwztWhich 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.