• Members 3 posts
    April 22, 2020, 5:02 p.m.

    Hi rafalp,
    After struggling with docker setup and installation, forum was almost built. Your work is quite amazing and fit for my needs. Thank you for your work and maybe I need some tips about it if possible.
    Do you have any doc for the APIs, such as posting a new thread remotely without login. All my potential data and articles were sleeping in GP or mysql dbs, I need to call your api to post new threads and wake them up.
    For sure, I can make a post request to submit new threads in JSON with a proper auth-token. If possible, is there any way out, a way more efficient and official.
    Such as: misago.threads.api.threadposts
    Thanks for your help.
    Best Regards
    Darcy

  • April 23, 2020, 10:40 p.m.

    Hello DarcyOly!

    Posting threads over JSON API seems to be easiest way to do this. Misago does a lot of things when thread is posted, and using JSON API is only sure way for all those things to happen.

  • Members 3 posts
    April 24, 2020, 5:41 p.m.

    Ummm... incredible, thanks anyway bro

  • Members 3 posts
    April 24, 2020, 7:46 p.m.

    For records, leave a JSON api format here:
    api address: (xxx.xxx.xxx.xxx/api/threads/)
    header should contain (at least):

        header = {
            'Referer': 'https://xxx.xxx.xxx.xxx/',
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36',
            'X-CSRFToken': 'yyy', 
            'Cookie': 'misagocsrftoken=yyy; misagosessionid=zzz',
        }
    

    json should be:

        content = {
            "title": 'xxx',
            "category": int('y'),
            "post": 'zzz',
            "attachments":[],
            "close":False,
            "hide":False,
            "pin":0}
    

    if SSL verification noticed, note a 'verify=False' to ur requests.
    That's it, hope it's helpful for the fresh ^-^