Skip to content
  • 0 Votes
    2 Posts
    518 Views
    barisB
    Yes, every page has a build hook based on the template it renders filter:<templateName>.build. In your case it would be filter:account/topics.build
  • 0 Votes
    1 Posts
    330 Views
    K
    Hi all, I'm trying to use the recently introduced WriteAPI to create topics and concurrently upload a file. I'm doing it via Python and I've already succeeded in create a simple topic without a file using something lilke payload = { "cid": cid, "title": title, "content": message } headers = { 'Authorization': 'Bearer '+nodebbToken, 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=json.dumps(payload)) but when it's about files using payload = { "cid": backstage_cid, "title": backstage_title, "content": backstage_message } headers = { 'Authorization': 'Bearer '+nodebbToken, 'Content-Type': 'multipart/form-data' } verifySSL = False print (payload) if (useFile): with open(backstage_file, 'rb') as f: response = requests.request("POST", url, headers=headers, data=payload, verify=verifySSL, files={backstage_file: f}) it returns Error: Required parameters were missing from this API call: cid, title, content cause passing the parameters in a plain dictionary rather than a JSON object seems not doable. The switch from JSON to dictionary is needed otherwise I wouldn't have been able to pass a file together with such header headers = { 'Authorization': 'Bearer '+nodebbToken, 'Content-Type': 'multipart/form-data' } Has anybody valuable suggestions here? Thanks in advance, Riccardo
  • 1 Votes
    9 Posts
    6k Views
    sehS
    @Giorgio-Chiodi thanks For now @psychobunny suggested to store JSON data in the post content. This will work if the post data is filtered for client display, and read for updates when sent to the server. This can be used to maintain a separate index of objects described in posts. For example, geolocations can be indexed in its own database for optimized queries. A post might have multiple associated geolocations, or several GeoJSON "shapes". { hash: { x: 'y', z: 3}, array: [0.5,"b"], number: 0.2 } Can Categories be considered a special kind of Tag? The main difference I see is that Topics can only appear in one Category though.