Create Quotes Post
In this example we will look at how to create a Quotes post using the Predis.ai API. We will set the value of post_type
to quotes
and the value of media_type
parameter to single_image
. Currently only single_image
is supported for generating Quotes post and hence any other value in media_type
will fail.
You can provide the actual text of the quote that you want to include in the post using the text
parameter. Optionally, you can also include the author
parameter to display the author name in the post.
import requests
url = "https://brain.predis.ai/predis_api/v1/create_content/"
payload = {
"brand_id": "YOUR_BRAND_ID",
"text": "All our dreams can come true if we have the courage to pursue them",
"media_type": "single_image",
"author": "Walt Disney", # optional
"template_ids": [], # pass template_ids if you want quotes in specific design
"post_type": "quotes"
}
headers = {"Authorization": "YOUR_API_KEY"}
response = requests.request("POST", url, data=payload, headers=headers)
if response.status_code == 200:
json_response = response.json()
post_id = response.get("post_id")
post_status = response.get("status")
else:
print("Error occurred - {}".format(response.text))
If you get a inProgress
status in response, your request is successful and the Quotes post is getting generated. Once the Quotes post gets generated successfully (or fails), you will get a request on your configured webhook URL with more details.