Page 1 of 1

How to add wapka api, post lister multiple forumid?

Posted: Wed May 22, 2024 7:41 am
by vikkas

Code: Select all

<a href="https://api.wapka.org/PostInfo?apikey={{VAR(APIKEY)}}&forumid=21425,limit=10,order='id_asc'">vikkas</a>
ex:<forumid>810,16927,16928,20382</forumid>
post lister
post lister
snapshot_m.wapka.org_1716363505623.png (122.19 KiB) Viewed 51447 times

Re: How to add wapka api post lister multiple forumid?

Posted: Wed May 22, 2024 10:57 pm
by francisco
Separate each id as follows: forumid[]=XXXXX, the important part is the square brackets [] indicating that the parameter is a list. Example:

Code: Select all

forumid[]=810&forumid[]=16927&forumid[]=16928&forumid[]=20382

Re: How to add wapka api post lister multiple forumid?

Posted: Thu May 23, 2024 1:28 am
by vikkas
Thank you, bro

Re: How to add wapka api post lister multiple forumid?

Posted: Thu May 23, 2024 3:43 am
by vikkas
wapka api post lister multiple forumid 💯 working, but lua not accepted

Code: Select all

local post_check1, post_list, post_stats = api.post_info({forumid[]=15554,forumid[]=24306,forumid[]=24510,limit=10})
if 10 > 0 then
    for loopindex, article in ipairs(post_list) do
        thumbnail = string.match(article['content'], "%[img%](.-)%[/img%]") or 'https://i.imgur.com/01T3Bxl.png'
        colors = {'red', 'blue', 'green', 'orange'}
        randomIndex = math.random(1, #colors)
        randomColor = colors[randomIndex]
        topicClass = "cat_"..randomColor
        category = article['ForumInfo']
        link = "/article/"..article['id'].."-"..article['title']..".html"
        local html = [[
            <div class="list">
                <div style="float:left">
                    <img src="]]..thumbnail..[[" title="]]..article['title']..[[" alt="]]..article['title']..[[" width="55" height="55" class="thumbnail"/>
                </div>
                <a href="]]..link..[["><b>]]..article['title']..[[</b></a><br/>
            <b>Category:</b> <span class="mau topic ]]..topicClass..[[">]]..category['name']..[[</span><br/>
                <b>Post:</b> ]]..article['date']..[[
            </div>
        ]]
        print(html)
    end
    print('?page=',p,page_max)
else
    print([[<div class="list1">post not found</div>]])
end
luapostlister
luapostlister
snapshot_sacmau.wapka.co_1716435664832.png (94.05 KiB) Viewed 51419 times

Re: How to add wapka api post lister multiple forumid?

Posted: Thu May 23, 2024 1:39 pm
by francisco
Delimit the html with [=[ and ]=]

Re: How to add wapka api post lister multiple forumid?

Posted: Thu May 23, 2024 3:44 pm
by vikkas
Thank you so much

Re: How to add wapka api post lister multiple forumid?

Posted: Fri May 24, 2024 2:21 am
by vikkas
bro, demo please
i can't add forumid[]=15554
Error found
how to add this code (forumid[]=15554) on lua

api.post_info({forumid[]=15554,forumid[]=24306,limit=10})

Re: How to add wapka api post lister multiple forumid?

Posted: Fri May 24, 2024 6:04 am
by francisco
The example I showed is for when a GET request is made to the REST API, exactly like your first question.

To do the same in Lua you simply pass the ids as a normal array:

Code: Select all

api.post_info({forumid={15554,24306}, limit=10})

Re: How to add wapka api post lister multiple forumid?

Posted: Fri May 24, 2024 7:11 am
by vikkas
Thank you very much

Re: How to add wapka api post lister multiple forumid?

Posted: Fri May 24, 2024 7:16 am
by vikkas
This code 💯 working, thank you for your help