Create a Post

Endpoint allows to create new Post

Create new post

POST https://api.whisk.com/v2/posts

Use this method for user that creates a new post. Depends on content user wants to attach the post use connected attachments in body.

If attachment equals recipe_with_rating then based on recipe_id in recipe_with_rating structure and content review will appear in recipe.

Headers

Name
Type
Description

Authorization*

String

User Access token to authorize the API usage. For more information, see Authentication

Request Body

Name
Type
Description

recipe_ids

Array

An array if recipe ids could be attached to post.

liked*

Boolean

Mandatory parameter, set default to true. Represents green like or red dislike.

tags

Array

Array of predefined tags could be attached to review. Will be shown in review. Also counts for recipe popular tags.

image

Object

Image object. Contain list of parameters related to image.

text

String

Text attached to post. If type of post equals recipe_with_rating text submitted here will be shown in review

text

Object

An object for text attribute

attachments

Object

An object for attaching content to a post. there could be an image, recipes, review (recipe_with_rating), communities. Recipes, review, communities are oneof, but it is possible to use an image with a single recipe attached. Multiple recipes type and community type used in automatic post creation from adding recipes to communities and creating communities and not represented in UX.

recipe_with_rating

Object

An object for attaching review to post. recipe_id and liked are mandatory for this specific type of attachment. Can't be used together with recipes, communities types. Image and text for this type could be attached to specific field of the post that why there are no presented in this object. When we create a post with recipe_with_rating attachment then we automatically create a review for recipe.

recipe_id*

String

Recipe id where review would be attached.

rating*

Object

Rating object with liked attribute

community_ids

Array

Community id's attached to post. (For specific types of automatically created posts)

Request body

Sample request and response

curl -X POST "https://api.b2c.whisk-dev.com/v2/posts" -H "accept: application/json" -H "Authorization: Bearer " -H "Content-Type: application/json" -d "{ "payload": { "text": { "text": "my 1st post" }, "attachments": { "images": [ { "url": "https://cloudinary-cdn.whisk.com/image/upload/v1676729718/recipe/cb06fd016e6081843ffdabdbae38d86e.jpg", "width": 0, "height": 0, "selection": { "x": 0, "y": 0, "width": 0, "height": 0 } } ], "recipe_with_rating": { "recipe_id": "101972b42b199c936a87bf09a4ab0c9de0a43a4e1eb", "rating": { "liked": true }, "tags": [ "not bad" ] }, "community_ids": [ ] } }}"

Last updated

Was this helpful?