How to add wapka api, post lister multiple forumid?

Ask anything you want to know
Post Reply
vikkas
Posts: 84
Joined: Sun May 07, 2023 9:28 am

How to add wapka api, post lister multiple forumid?

Post 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 53075 times
Last edited by vikkas on Thu May 30, 2024 12:47 pm, edited 1 time in total.
User avatar
francisco
Posts: 62
Joined: Tue Mar 07, 2023 1:48 pm
Location: Brazil
Contact:

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

Post 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
😴
vikkas
Posts: 84
Joined: Sun May 07, 2023 9:28 am

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

Post by vikkas »

Thank you, bro
vikkas
Posts: 84
Joined: Sun May 07, 2023 9:28 am

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

Post 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 53047 times
User avatar
francisco
Posts: 62
Joined: Tue Mar 07, 2023 1:48 pm
Location: Brazil
Contact:

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

Post by francisco »

Delimit the html with [=[ and ]=]
😴
vikkas
Posts: 84
Joined: Sun May 07, 2023 9:28 am

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

Post by vikkas »

Thank you so much
vikkas
Posts: 84
Joined: Sun May 07, 2023 9:28 am

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

Post 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})
User avatar
francisco
Posts: 62
Joined: Tue Mar 07, 2023 1:48 pm
Location: Brazil
Contact:

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

Post 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})
😴
vikkas
Posts: 84
Joined: Sun May 07, 2023 9:28 am

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

Post by vikkas »

Thank you very much
vikkas
Posts: 84
Joined: Sun May 07, 2023 9:28 am

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

Post by vikkas »

This code 💯 working, thank you for your help
Post Reply