Forum Discussion
Hi Parshant,
thank you for your quick reply .... i am unsure what you mean with your statement you need to login before ..
When trying the call with API Browser inside Studio i am always signed in otherwise i could not reach the API Browser :-)
Maybe i should make it a little more transparent how you can reproduce it:
Preparation:
1. create a new board (type Blog) with the board-id e.g. "myblog1"
2. create an additional board (tpye Blog) with the board-id e.g. "myblog2"
3. create several blog articles per blog
4. now bookmark an article of "myblog1" without bookmarking other articles in "myblog2"
Test it via API Browser
- after bookmarking the article in "myblog1" visit the API Explorer in Studio
- now make the following call: SELECT * FROM bookmarks WHERE node.id='boards:myblog1'
- Expectation: in the response you should see the bookmarked article of myblog1 ( this works)
- now make the following call: SELECT * FROM bookmarks WHERE node.id='boards:myblog2'
- Expectation: in the response there should be no found bookmark, instead it will show again the bookmark of myblog1 article and this is not the expected result !
I thought You were making the V2 call directly from browser and not from studio.
I have found the way to figure out this issue on your side.
Use below API to fetch results for bookmark from Board using your example
SELECT * FROM bookmarks WHERE target.type = 'board' and target.id='myblog1'
I have tested this on our community as well and its works like a charm.
- STARFLEET7 years agoExpert
Hi Parshant,
thanks again for your reply, but the mentioned query is not wokrking and i am wondering how the query can work for you as the target.id cannot be the id of the board. It is the message id of the bookmarked message. The best example is the response i am getting after doing my calls:
{ "status" : "success", "message" : "", "http_code" : 200, "data" : { "type" : "bookmarks", "list_item_type" : "bookmark", "size" : 1, "items" : [ { "type" : "bookmark", "id" : "54", "href" : "/bookmarks/54", "target" : { "type" : "conversation", "id" : "1337", "view_href" : "/t5/Principles/MyPrinciple3/ba-p/1337", "style" : "blog", "thread_style" : "blog", "messages_count" : 1, "solved" : false, "last_post_time" : "2018-08-13T21:12:58.753+02:00", "last_post_time_friendly" : "Monday" }, "subscriber" : { "type" : "user", "id" : "4", "href" : "/users/4", "view_href" : "/t5/user/viewprofilepage/user-id/4", "login" : "STARFLEET" } } ] }, "metadata" : { } }
You can easily see that the target.id cannot be the board.id.
I've tried it also with target.type='conversation' as i saw the target.type= 'conversation ' in the result.The bookmarked message is in our blog with the id "wlb_community-principles".
I have a second blog which contains no bookmarks of the calling user, but using the blog.id of this will give again back the response above - and this is still wrong.- Parshant7 years agoBoss
If you write target.type = 'conversation' in your query it will return all the conversation means only messages from the bookmarks. You can not pass board.id with the target.type = 'conversation' . You can only pass target.id of related target.type
and If you need to get all bookmark results from your one blog you need to add
target.type = 'board' and target.id='wlb_community-principles'
both in your where clause.
If you are still facing this problem
- STARFLEET7 years agoExpert
I guess my post resulted in a misunderstanding on your side.
What i meant was, that i have ALSO tried it with the conversation as target.type because it was part of the object on the response.
I also tried to show you that target.id cannot be any board-id or node.id. It can only be a message-id.To sum it up, what i did so far is:
Assume i have 2 blogs, the first one with the board-id "wlb_communities-principles" and the second one with the board-id "wlb_communities-stories". The user has bookmarked only one message within the "wlb_communities-principles".
Overview about the tested queries:
SELECT * FROM bookmarks
Response:
{ "status" : "success", "message" : "", "http_code" : 200, "data" : { "type" : "bookmarks", "list_item_type" : "bookmark", "size" : 1, "items" : [ { "type" : "bookmark", "id" : "54", "href" : "/bookmarks/54", "target" : { "type" : "conversation", "id" : "1337", "view_href" : "/t5/Principles/MyPrinciple3/ba-p/1337", "style" : "blog", "thread_style" : "blog", "messages_count" : 1, "solved" : false, "last_post_time" : "2018-08-13T21:12:58.753+02:00", "last_post_time_friendly" : "Monday" }, "subscriber" : { "type" : "user", "id" : "4", "href" : "/users/4", "view_href" : "/t5/user/viewprofilepage/user-id/4", "login" : "STARFLEET" } } ] }, "metadata" : { } }
RESULT: this is OK, as the query will give back every existing bookmark of the user
SELECT * FROM bookmarks WHERE target.type='board' and target.id='wlb_communities-principles'
Response:
{ "status" : "success", "message" : "", "http_code" : 200, "data" : { "type" : "bookmarks", "list_item_type" : "bookmark", "size" : 0, "items" : [ ] }, "metadata" : { } }
Result: this is not OK, the expectation would be that the bookmarked item will be in the response, but as i said before, this is NOT a surprise for me, because the target id has to be a message id and therefore this query cannot work !
SELECT * FROM bookmarks WHERE node.id='boards:wlb_communities-principles'
Response:
{ "status" : "success", "message" : "", "http_code" : 200, "data" : { "type" : "bookmarks", "list_item_type" : "bookmark", "size" : 1, "items" : [ { "type" : "bookmark", "id" : "54", "href" : "/bookmarks/54", "target" : { "type" : "conversation", "id" : "1337", "view_href" : "/t5/Principles/MyPrinciple3/ba-p/1337", "style" : "blog", "thread_style" : "blog", "messages_count" : 1, "solved" : false, "last_post_time" : "2018-08-13T21:12:58.753+02:00", "last_post_time_friendly" : "Monday" }, "subscriber" : { "type" : "user", "id" : "4", "href" : "/users/4", "view_href" : "/t5/user/viewprofilepage/user-id/4", "login" : "STARFLEET" } } ] }, "metadata" : { } }
RESULT: this is OK ! And i was happy that his query delivers exact 1 bookmarked item within the specific board. To ensure that this is really working, I did the same call for the board where no bookmark was set:
SELECT * FROM bookmarks WHERE node.id='boards:wlb_communities-stories'
Response:
{ "status" : "success", "message" : "", "http_code" : 200, "data" : { "type" : "bookmarks", "list_item_type" : "bookmark", "size" : 1, "items" : [ { "type" : "bookmark", "id" : "54", "href" : "/bookmarks/54", "target" : { "type" : "conversation", "id" : "1337", "view_href" : "/t5/Principles/MyPrinciple3/ba-p/1337", "style" : "blog", "thread_style" : "blog", "messages_count" : 1, "solved" : false, "last_post_time" : "2018-08-13T21:12:58.753+02:00", "last_post_time_friendly" : "Monday" }, "subscriber" : { "type" : "user", "id" : "4", "href" : "/users/4", "view_href" : "/t5/user/viewprofilepage/user-id/4", "login" : "STARFLEET" } } ] }, "metadata" : { } }
RESULT: this is NOT OK, there should be NO bookmarked item in the response for this board!
I guess this is a bug !!These are my findings so far and i did not find a way to show only bookmarks of a user specific for a board.
Related Content
- 12 months ago
- 2 years ago