List all posts
Use the .get_post() function to get the latest version of each post sorted by most recent
Returns
The function returns an object containing a posts array as well as details on the number of posts and pages returned:
The "post objects" within the array returned are made of a combination of:
the post message object
additional details to help reference the original post (original_...)
the
post.item_content
object attributes (type, content, address, time
) are merged in at the top level of the post result
Usage
Required parameters
Parameter | Description |
---|---|
post_types - comma separated string | Posts with the "post_types" in the The value is a string of one type or multiple types separated with commas without extra space. ex: |
Optional parameters
In addition to the required parameters above, an object of optional parameters can be passed following the post_types to further filter the list returned:
posts.get_posts(post_type,
{pagination: 200}
)
api_server - string
Default: "https://api1.aleph.im"
Target API server
pagination - integer
Default: 200
The number of posts returned per page
page - integer
Default: 1
The page to be returned.
ex: page 1 or page 2
refs - array
Default: null
Array of Refs listed in the post
item_content.ref
addresses - array
Default: null
Array of addresses listed in the content address (
item_content.address
)If multiple addresses are passed, any message with one of the queried addresses in the content address or sender attribute will be returned.
tags - array
Default: null
Array of Message content content tag. (
item_content.content.tags
).If multiple tags are passed, messages with at least one of the tags present in the content content tags will be returned.
hashes - array
Default: null
Array of hashes listed in the item hash (
item_hash
) or transaction hash (tx_hash
)
Example: Get_posts
In the response, the item_content
object attributes (type, content, address, time
) are merged in the post message object to be easily reachable. Item_content
is still available in the message object as well.
The original_
fields are here in case you amended the post.
This function retrieves the latest version of all posts. If a post was updated twice after the original version was created, only the last updated post will show.
To see all the changes made to a post, check the next header item (To retrieve all changes made to a post)
History for a post
To retrieve all updates made to a specific post and the original post, use list all messages endpoint rather than list all posts referencing the original item hash. When using list all posts with the item_hash reference, any updated posts, including amends of amends will get displayed whether or not they were performed by the account address. In addition, the original post cannot be retrieved by this endpoint.
Last updated