Write API JSON requirements

NodeBB Development

Suggested Topics


  • 0 Votes
    3 Posts
    1k Views

    I already have the array of topic IDs. I want to retrieve all of those topics by their IDs.

    My current solution is to just loop through the array and do a fetch on the api for each ID individually, and then use a Promise.all to return the finished batch to my client middleware. Making separate http requests for each one is less desirable though, and I would prefer to get them all in a single fetch if possible.

  • 1 Votes
    4 Posts
    2k Views

    @baris He said he uses 1.4.5 and Chrome in Mac OS.He tried to destroy his friend's experimental community,and then my friend's forum throwed an error:(See the image)

    0_1492190618361_-219a3516140dd67a.png

  • 0 Votes
    8 Posts
    4k Views

    Reporting back. Using existing libraries, this is much simpler than I was making it. Here's some sample Python code which posts "Hello, World!" to topic ID 2. Thanks, @julian, for telling me about socket.io.

    from socketIO_client import SocketIO, LoggingNamespace import requests import json session = requests.Session() csrf_token = json.loads(session.get('http://yourdomain:port/api/config').text)['csrf_token'] headers = { 'x-csrf-token': csrf_token } data = { "username": "yourUsername", "password": "yourPassword" } response = session.post("http://yourdomain:port/login", headers=headers, data=data) def on_response(*args): print('on_response', json.dumps(args)) with SocketIO('yourdomain', port, LoggingNamespace, cookies=session.cookies.get_dict()) as s: s.emit('posts.reply', {'tid': 2, 'content': "Hello, World!"}, on_response) s.wait_for_callbacks(seconds=1)
  • 0 Votes
    3 Posts
    3k Views

    @frissdiegurke

    Here is a link: http://devdocs.io/

    I can't believe I forgot that.

    For example I'm not able to disable any of the enabled APIs.

    Are you sure? Did you try clicking the "Select Documentation" button at the bottom? I'm pretty sure you can disable those...

    Also by selecting one of the APIs the URL changes but by refreshing the page-content gets changed.

    I don't see any page content changing, what do you mean?

  • 1 Votes
    11 Posts
    8k Views

    @frissdiegurke Knowing what I know now, @julian post can be construed to contain all the information :). I would word it differently though as SSO is probably veyr widely used. And if so, then calling port optional is...well, still technically correct.