Growing Successful Communities

0
Occasional Advisor
gabatra

REST API: Message APIs returning incorrect results

06-26-2009 04:46 PM

Hi,

 

We have implemented Lithium forums. If I click on a message in a forum, I see a URL like:

 

http://forums.xyz.com/board/message?board.id=pqr&thread.id=5948

 

Now when I try to use the following REST API:

 

http://forums.xyz.com/restapi/vc/messages/id/5948/board

 

I expect the above API to return board "pqr" but for some reason it is returning a different board id.

 

What could be the reason that the above API is returning incorrect board id in our instance? I see the same issue with other APIs.

 

Thanks for all your help!

Lithium Technologies
ChristineC

Re: REST API: Message APIs returning incorrect results

06-29-2009 10:48 AM

Hi gabatra,

 

The first url you are showing lists a thread id of  "5948".  The thread id is different than the message id.  Can you try "restapi/vc/threads/id/<threadid>/board" and see if that gives you back the expected results?

0
Occasional Advisor
gabatra

Re: REST API: Message APIs returning incorrect results

06-29-2009 12:17 PM

Hi,

 

As per your suggestion, tried the following:

 

http://forums.xyz.com/restapi/vc/threads/id/5948/board

 

But even this doesn't return board id as "pqr". This returns the same board id as my earlier query:

 

http://forums.xyz.com/restapi/vc/messages/id/5948/board

 

Also, as per my understanding, thread id is same as the message id of the first message in that thread, so it shouldn't really matter.

 

Thanks.

Lithium Technologies
dhauge

Re: REST API: Message APIs returning incorrect results

06-29-2009 01:15 PM

 

Hi,

 

This is a confusing aspect of messages, which is not made clear in the docs. Each message basically has two integer ids, one uniquely identifies the message only within a board, and the other uniquely identifies a message across the entire community. When a URL specifies both a board id and a message id, it is using the board-relative message id. When it only specifies a message id, it is using the community-wide message id. To get a message using the board id and message id you see in a message URL, you can use

 

http://forums.xyz.com/restapi/vc/boards/id/pqr/messages/id/5948

 

That will give you the message with board-relative id '5948' within the board 'pqr'.

 

http://forums.xyz.com/restapi/vc/messages/id/5948

 

Will give you the message with the community-wide id '5948', which has no particular relation to the message with that id in board 'pqr'.

 

In a message response, the 'id' element always specifies the community-wide message id. The misnamed 'board_id' element specifies the message's board relative id.

 

Doug

 

 

 

 

 

 

 

 

0
Occasional Advisor
gabatra

Re: REST API: Message APIs returning incorrect results

06-29-2009 02:44 PM

Hi Doug,

 

Thanks for your reply. This answers my question.

 

 

0
Lithium Technologies
ChristineC

Re: REST API: Message APIs returning incorrect results

06-29-2009 03:12 PM

Thanks dhauge!  Sorry, gabatra for the confusion.