Get posts
This API endpoint allows retrieving the list of reflections/post.
By using different query string, users can fetch posts that meet specific criteria, such as the most popular or latest posts, or posts created by a specific user. Some of these query strings are explained below:
tab
query string, following table explain thetab
value and expected results.
NOTE: For some
tab
value, user need to be logged in otherwise system will return an empty array.
NOTE:
access-token
,client
and other auth headers are optional for this api. But you'll need to provide these headers if need to accessprivate notes
of author.
tab value | Explanation | Required auth headers |
---|---|---|
newest | recent posts at top | No |
following | return reflections of authors that current user is following | Yes |
draft | returns current user's private notes | Yes |
favorite | returns current user's favorite posts | Yes |
most_popular | default tab value. Return most popular posts | No |
only_room_members | Send posts that are posted by current room members | No |
public | Include public posts of private rooms | No |
feed | feed is special tab value, this will ignore most filters(See below) and send verified posts(if verified is true), posts that are reviewed by scholars, posts from author current user is following(if user is logged in) etc | No |
q
parameter is used for further customizing the results, you can fetch posts of specific members, post that have specific tags, post for specific surah, ayah range or single ayah etc.
Filter posts of specific users
q[author_ids]=1,2,3
=> Get posts of author whose ids are 1,2, or 3.
Filter by specific post type
q[post_type_ids]
-> Comma-separated post type IDs. Post Type | Post Type Id ---------|---------- Reflection | 1
Filter by Tags
q[tag_ids]
is array query string, you can include multiple tags using following format:
q[tag_ids][]=11&q[tag_ids][]=33
Filter by specific ayah or range
q[filters_attributes][0][chapter_id]=1
-> Reflection of first surahq[filters_attributes][0][from]=1&q[filters_attributes][0][to]: 3
-> Filter down reflection to first 3 ayah of first surah
You can use multiple filters_attributes
to tailor results to your needs.
Logical operation for filters
- q[filters_operation]=
OR
orAND
. OR will send results that matches any filters. AND will perform inclusive operation, i.e return results that matches all conditions. - q[tags_operation]=
OR
orAND
Query Parameters
Client API token
Default value: false
If true
system will send verified reflections
Default value: en
Comma separated list of iso codes of languages, use this if you want to fetch posts in specific language.
Get posts that are updated after given date
Default value: false
Get post for exact ayah, normally system will include posts for ayah range
Get posts for ayahs that are within give filter range
See above description
Include scholars post
Include student of knowledge member's post
shortcut if you need posts from scholars and student of knowledge members
Possible values: [newest
, following
, draft
, favorite
, most_popular
, only_room_members
, public
, feed
]
see description about tab above
Header Parameters
user access token
client access token
timestamp of token expiry
access token type
user uid
- 200
- 401
- 403
- 500
OK
Response Headers
Schema
- Array [
- Array [
- ]
- Array [
- ]
- Array [
- ]
- ]
posts object
posts object[]
The ID of the post.
the post text
The number of likes.
Whether the post should be publicly viewed or not.
The date the post was published at. Format of the date is MMMM dd, yyyy HH:mm
Whether the post is global or not. A post inside a room can be set to global and becomes visible to everyone.
Whether the post is editable or not. It will be true
if the post belongs to the current user.
Whether the post is deletable or not. It will be true
if the post belongs to the current user.
Whether the current user can report the post or not.
citation_texts object[]
translation text
name of the translation
from ayah number
to ayah number
The language of the post.
The number of views.
author object
filters object[]
tags object[]
the #tag
Default value: 0
The average time it takes to read the post
{
"posts": {
"posts": [
{
"id": 0,
"body": "string",
"likes": 0,
"draft": true,
"published_at": "string",
"global": true,
"editable": true,
"deletable": true,
"reportable": true,
"citation_texts": [
{
"id": 0,
"text": "string",
"translated_name": "string",
"from": 0,
"to": 0,
"translation_id": 0
}
],
"language": "string",
"detected_translation": 0,
"views": 0,
"comments": [
{}
],
"liked": true,
"author": {
"id": 0,
"username": "string",
"name": "string",
"verified": true,
"profile_img": "string"
},
"filters": [
{
"id": 0,
"from": 0,
"to": 0,
"indicator_text": "string"
}
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"estimated_reading_time": 55018.9
}
]
}
}
Get posts API not member in group
{
"success": false,
"message": "You are not member of this group!"
}
HomePage Posts Api
{
"posts": {
"posts": [
{
"id": 8,
"body": "<div>The most interesting thing about this verse is that it's not only telling us to use our talents for a higher purpose, but it's also telling us that we can make money and a worldly benefit in the process.</div>",
"likes": 9,
"draft": false,
"published_at": "December 28, 2016 06:27",
"room_id": null,
"global": true,
"editable": false,
"deletable": false,
"reportable": null,
"citation_texts": {
"0": [
{
"id": 22037,
"citation_id": 29,
"number": 77,
"text": "But seek, through that which Allah has given you, the home of the Hereafter; and [yet], do not forget your share of the world. And do good as Allah has done good to you. And desire not corruption in the land. Indeed, Allah does not like corrupters.\"",
"translation_id": 5
}
]
},
"language": "ENGLISH",
"detected_translation": 5,
"views": 439,
"group": null,
"group_link": null,
"comments": [
{
"id": 127,
"body": "",
"is_private": false,
"created_at": "2018-08-07T09:40:38.000Z",
"comment_policy_show": true,
"author": {
"id": 11,
"username": "amerabbas",
"name": "Amer Abbas",
"verified": false,
"profile_img": "/system/users/avatars/000/000/011/original/data?1533416312",
"followed": false
}
}
],
"trimmed_citation_texts": {
"0": [
{
"id": 22037,
"citation_id": 29,
"number": 77,
"text": "But seek, through that which Allah has given you, the home of the Hereafter; and [yet], do not forget your share of the world. And do good as Allah has done good to you. And desire not corruption in the land. Indeed, Allah does not like corrupters.\"",
"translation_id": 5
}
]
},
"author": {
"id": 12,
"username": "hizzeldin",
"name": "Hisham Izzeldin ",
"verified": false,
"profile_img": null,
"followed": false
},
"filters": [
{
"id": 211,
"from": 77,
"to": 77,
"indicator_text": null
}
],
"tags": [
{
"id": 10,
"name": "Personal Development"
}
]
}
]
},
"pages": 41
}
Unauthorized response, api will respond with this 401 eithr user is not logged in or do not have permission to perform some action. Like creating a post in a room, but user is not member of room.
System will also return 401 if api token is missing or invlaid.
Schema
Default value: 401
Default value: false
{
"errors": [
"string"
],
"status": 401,
"success": false
}
{
"errors": [
"You need to sign in or sign up before continuing."
],
"success": false
}
{
"message": "You don't have permission!",
"status": 401,
"success": false
}
Forbidden, api key is missing or invalid
Schema
Default value: false
Default value: 401
{
"success": false,
"message": "string",
"status": 401
}
{
"success": false,
"message": "You don't have permission!"
}
Internal server error, api will respond with 500 if something went wrong processing the request.
Schema
Default value: false
Default value: internal server error
error message
{
"success": false,
"message": "internal server error"
}