Write API

Technical Support
  • #1

    Could somebody show me an example of making a post with the write API?
    I tried integrating Reddit and Nodebb (Horrible idea, I know.) and I still don't know how to make a post with a user token.

  • #2

    Look this :

    import requests
    class auto_topic():
        def __init__(self,api_url,bearer_token):
            self.api_url = api_url
            self.bearer_token = bearer_token
        def create(self,uid,cid,title,content):
            headers = {"Authorization": "Bearer %s"%self.bearer_token}
            topic = {'uid':uid,'cid':cid,'title':title,'content':content}
            response = requests.post(self.api_url,headers = headers,data=topic)
            return response

Suggested Topics

| | | |