Protocol Post - GoryMoon/DIT076-Flow GitHub Wiki

##################################################
##########  GET ALL POST(S)       (DEV) ##########
##################################################
GET localhost:8080/api/post/
input: -
output: json [{
		"ownerid":"123",	// id of user who posted
		"groupid":"123",	// id of group the post was posted in
		"id":"123",		// id of post
		"nick":"abc",		// nick of owner
		"title":"abc",		// title of post
		"text":"abc",		// text of post
		"time":timestamp	// timestamp of when it was posted
	}, ...] 
	status: 200 OK
##################################################

##################################################
##########  GET POST(S)  (RELEASE) V3.2 ##########
##################################################
POST localhost:8080/api/post/get/
input:	json '{
		"userid":"123",		// userid must be valid user
		"ownerid":"123",	// ownerid of post must match completely
		"groupid":"123",	// post must be in this group
		"nick":"xnick",		// nick of poster must contain this string	- 501 Not Implemented
		"id":"123",		// id of post must match completely		- 501 Not Implemented
		"title":"abc",		// title of post must contain this string	- 501 Not Implemented
		"text":"abc",		// text of post must contain this string	- 501 Not Implemented
		"before":timestamp},	// get posts at or before			
		"after":timestamp},	// get posts at or after			
		"count":"10"		// Max amount to get				
	}'
output:	json [{
		"ownerid":"123",	// id of user who posted
		"groupid":"123",	// id of group the post was posted in
		"id":"123",		// id of post
		"nick":"abc",		// Nick of owner
		"group":"abc",		// Name of group
		"title":"abc",		// title of post
		"text":"abc",		// text of post
		"status":"0",		// Visibility setting for the post for user with id userid. 0: Visible, 1: Hidden
		"time":timestamp 	// timestamp
	}, ...]
	status: 200 OK
##################################################

##################################################
##########  PUT POST     (RELEASE) V3.3 ##########
##################################################
PUT localhost:8080/api/post/put/
input:	json '{
		"userid":"123",		// userid must be valid user and have authority
		"id":"123",		// id of post to modify	
		"title":"abc",		// title of post will be this string		- 501 Not Implemented
		"text":"abc",		// text of post will be this string		- 501 Not Implemented
		"status":"hidden"	// status the post will have
	}'
output:	json '{
		"ownerid":"123",	// id of user who posted
		"groupid":"123",	// id of group the post was posted in
		"id":"123",		// id of post
		"nick":"abc",		// Nick of owner
		"group":"abc",		// Name of group
		"title":"abc",		// title of post
		"text":"abc",		// text of post
		"status":"0",		// Visibility setting for the post for user with id userid. 0: Visible, 1: Hidden
		"time":timestamp 	// timestamp
	}'
	status: 200 OK
##################################################

##################################################
##########  POST POST    (RELEASE) V3.2 ##########
##################################################
POST localhost:8080/api/post/post/
input:	json '{
		"userid":"123",		// userid must be valid user
		"groupid":"123",	// id of group the post will be posted in
		"title":"abc",		// title of post
		"text":"abc",		// text of post
		"status":"visible"	// status the post will have			- 501 Not Implemented
	}'
output:	json '{
		"ownerid":"123",	// id of user who posted
		"groupid":"123",	// id of group the post was posted in
		"id":"123",		// id of post
		"nick":"abc",		// Nick of owner
		"group":"abc",		// Name of group
		"title":"abc",		// title of post
		"text":"abc",		// text of post
		"status":"0",		// Visibility setting for the post for user with id userid. 0: Visible, 1: Hidden
		"time":timestamp	// timestamp of when it was posted
	}'
	status: 200 OK
##################################################