Status Messages
Posted: Tue Jan 01, 2013 11:54 pm
The Codenstuff Site API (WIP)
Status Messages
At the moment the API allows you to access the following data on the site:
Status Messages & Message replies
Your own profile information
Grab a list of all your friends
Get your friends profile information
Post/Delete Messages & replies
So everything required to access and use the Status Messages feature on the site is available now in the API.
The API can be accessed via the following URL:
output
twid (This would be the member ID number of another user/friend)
skey (This is your personal secret API key)
newm (The text for posting a new message/reply/post)
messid (The id number of a message when editing/posting replies ect)
You can use these variables in either GET or POST requests. The variables marked with 'Default' indicates the default value of that variable. Modes highlighted in orange are GET only requests and those highlighted in blue are POST only.
OK so how would we use those?. Lets see a few examples...
Get a list of all messages:
An example of how to get new messages would be lets say we first got a list of ALL messages what we would do is save the highest message 'id' from that list so lets say the highest message id is 234. Now we already have all the messages so we dont want to get the full list again just to display new ones so we would just ask the API to send us messages with an 'id' higher than 234 so only new messages posted since we last got the list would be sent to us.
You will notice I included 'username' and 'skey' variables in that URL and that is because you are required to send that information with every API call in order to verify who you are and that you have permission to use it. I also didn't give it an 'output' variable because the API automatically sends data in Json format but if I wanted it in XML I would change my call URL to:
Ok so I think that covers the basics on usage of the API and how to access the various pieces of data so I will move on and try to explain how the data received is formatted.
To learn how to post and delete messages please see this post: viewtopic.php?f=226&t=10259&p=74534#p74534
See post below!.
Status Messages
At the moment the API allows you to access the following data on the site:
Status Messages & Message replies
Your own profile information
Grab a list of all your friends
Get your friends profile information
Post/Delete Messages & replies
So everything required to access and use the Status Messages feature on the site is available now in the API.
The API can be accessed via the following URL:
api/LiveAPIJsonXML.phpThese are the URL variables required to access the relevant information:
output
- json (Get data in Json format - Default)
- xml (Get data in XML format)
- Messages (Get a list of all recent status messages - Default)
- UserMessages (Get a specific members status messages)
- SelfProfile (Get your profile information)
- UserProfile (Get another users profile information)
- Mates (Get a list of all your friends)
- DelM (Delete a message)
- DelMR (Delete a message reply)
- NewM (Post a new message)
- NewMR (Post a new message reply)
twid (This would be the member ID number of another user/friend)
skey (This is your personal secret API key)
newm (The text for posting a new message/reply/post)
messid (The id number of a message when editing/posting replies ect)
You can use these variables in either GET or POST requests. The variables marked with 'Default' indicates the default value of that variable. Modes highlighted in orange are GET only requests and those highlighted in blue are POST only.
OK so how would we use those?. Lets see a few examples...
Get a list of all messages:
Code: Select all
Get a list of all recent/new messages:/LiveAPIJsonXML.php?mode=Messages&username=USERNAME&skey=ABCD123456
Code: Select all
Now "messid" would tell the API that you want new messages only and not all the messages. Each message you get from the API has an 'id' number and you use this number for example when posting a reply to a message so the API knows which message you are replying too. /LiveAPIJsonXML.php?mode=Messages&username=USERNAME&skey=ABCD123456&messid=234
An example of how to get new messages would be lets say we first got a list of ALL messages what we would do is save the highest message 'id' from that list so lets say the highest message id is 234. Now we already have all the messages so we dont want to get the full list again just to display new ones so we would just ask the API to send us messages with an 'id' higher than 234 so only new messages posted since we last got the list would be sent to us.
You will notice I included 'username' and 'skey' variables in that URL and that is because you are required to send that information with every API call in order to verify who you are and that you have permission to use it. I also didn't give it an 'output' variable because the API automatically sends data in Json format but if I wanted it in XML I would change my call URL to:
Code: Select all
Get a list of friends:/LiveAPIJsonXML.php?mode=Messages&username=USERNAME&skey=ABCD123456&output=xml
Code: Select all
Get your profile information:/LiveAPIJsonXML.php?mode=Mates&username=USERNAME&skey=ABCD123456
Code: Select all
Get a friends profile information:/LiveAPIJsonXML.php?mode=SelfProfile&username=USERNAME&skey=ABCD123456
Code: Select all
In this one we added the 'twid' variable because we need to tell the API which friends data we want./LiveAPIJsonXML.php?mode=UserProfile&twid=23&username=USERNAME&skey=ABCD123456
Ok so I think that covers the basics on usage of the API and how to access the various pieces of data so I will move on and try to explain how the data received is formatted.
To learn how to post and delete messages please see this post: viewtopic.php?f=226&t=10259&p=74534#p74534
See post below!.