# ttdc TTDC.us. My personal website.
Where my friends and i hang out online.
Tech: gwt, hibernate, json
//Samples for the new REST interface. Still beta, but it's in production.
Login. Used to get a token.
URL:http://ttdc.us/restful/loginRequest:
{ "username": "Trav", "password": "pa$$word" }
Response:
Person object and a token
Validate. Used to validate a token.
URL:http://ttdc.us/restful/validateRequest:
{ "token":"rO0ABXNy..." }
Response:
Person object and a token
Get a collection of the latest posts
URL: http://ttdc.us/restful/latestpostsRequest:
{ "action": "LATEST_GROUPED", "pageNumber": 1 }
Response:
A jason object with with some details about the page size, page number requested and a 'list' argument which contains a 1 level deep hierarchy of the latest posts visbile to all users of TTDC sorted by the conversation with the most recient reply
Request:
{ "action": "LATEST_FLAT", "pageNumber": 1 }
Response:
Same as above except the list contains no hierarchy. Just the posts sorted in reverse creation order.
Request:
{ "action": "LATEST_FLAT", "pageNumber": 1, "token": "token=rO0ABXNy......." }
Response:
Same as above except now all post visibile to a user with the given security token are in the result list. (Private and Muted filters are applied)
Get a thread (topic)
URL: http://ttdc.us/restful/topicRequest:
{ "postId": "7F1A7436-DDF6-4980-AC1A-F3AD0A5E4171", "pageNumber": 1, "type": "NESTED_THREAD_SUMMARY", "token": "rO0ABXN...(Optional)" }
Response:
Returns a results json object with a format similar to request the latest comments grouped.
Request:
{ "postId": "15807D62-5841-43FA-A004-292F6820283F", "pageNumber": 1, "type": "CONVERSATION" }
Response:
Returns the list of replies to a conversation.
Post CRUD operations
URL: http://ttdc.us/restful/post/* Create a post with on the fly login Request:
{ "parentId": "7F1A7436-DDF6-4980-AC1A-F3AD0A5E4171", "action": "CREATE", "body": "Bla bla bla bla bla, yada yada", "login": "Trav", "password": "pa$$word" }
Response:
Response contains the newly created post object
/* Create a post with a token Request:
{ "parentId": "7F1A7436-DDF6-4980-AC1A-F3AD0A5E4171", "action": "CREATE", "body": "Bla bla bla bla bla", "token": "rO0ABXN...." }
Response:
Response contains the newly created post object
/* Create a post on a new topic Request:
{ "action":"CREATE", "body":"Conversation from json with new topic!", "forumId":"293C8189-44B9-41BD-BC75-F3DFD7CF670B", "title":"First Thread From Json", "topicDescription":"TTDC is going mobile. For that we need JSON. I am the body of the first topic created this way.", "token":"rO0ABXN..." }
/* Read a single post Request
{ "postId":"977E6A57-AE9E-461C-BFD6-2D4D337F6C69", "action":"READ" }
Response:
Response contains the post object
/* Search
Request: URL: https://ttdc.us/restful/latestConversations
{ "postSearchType": "CONVERSATIONS", "pageNumber": 1, "sortOrder": "BY_DATE", "sortDirection": "DESC" }
Response:
Results with a list of posts. Note: This command has a lot more functionalty that isnt documented yet.
Request: URL: https://ttdc.us/restful/autocomplete
{ "query": "ta", "token": "" }
Response:
List of conversations that contain the query string
Request: URL: https://ttdc.us/restful/forum
{ "action":"LOAD_FORUMS" }
Response:
List of forums
Request: URL: https://ttdc.us/restful/register
{ "deviceToken":"iOS Device Token String", "token": "rO0ABXNy..." }
Response:
HTTP: 202
Request: URL: https://ttdc.us/restful/like
{ "postId": "8BEA35AA-5CFD-4401-858C-C0D35C5ABB72", "token": "rO0ABXNy..." }
Response:
HTTP: 200
Request: URL: https://ttdc.us/restful/unlike
{ "postId": "8BEA35AA-5CFD-4401-858C-C0D35C5ABB72", "token": "rO0ABXNy..." }
Response:
HTTP: 202
Request: URL: https://ttdc.us/restful/connect
{ "token": "rO0ABXNy..." (Tokens are optional here!) }
Response:
A connection id
Request: URL: https://ttdc.us/restful/serverEventList
{ "connectionId":"CONN ID GOES HERE", "token": "rO0ABXNy..." (Optional here too!) }
Response:
An object with the person who made the request (or anonymous) and the list of events that have occured.
Note, here are the event types that i plan to test, but there are a lot more: TRAFFIC - Person NEW, EDIT, DELETE - Post NEW_TAG, REMOVED_TAG - TagAssociation RESET_SERVER_BROADCAST - null?
Request: URL: https://ttdc.us/restful/person
{ "personId":"Person ID goes here" "type":"LOAD" "token": "rO0ABXNy..." }
Response:
A connection id