-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_doc.json
174 lines (152 loc) · 8.35 KB
/
api_doc.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
- login : path = /login
params = username : String ,password=String
Description = login to website
roles = user,admin
Response = {"result":true/false,"message":"error message if result is false"}
Error Messages ="wrong format or missing parameter"
"db problem"
"wrong username or password"
"your account has not been confirmed by admin yet"
"Internal Server Error"
- logout : path = /logout
params = -----
Description = guess!
roles = user,admin
Response = -----
- signup : path = /signup
params = username : String ,password=String,name=String,family=String,
Description = again,guess!
roles = user,admin
Response = {"result":true/false,"message":"error message if result is false"}
Error Messages ="wrong format or missing parameter"
"db problem"
"repeated username"
- userstatus : path = /specify_user_status
params = username : String ,status=String(confirm/reject),roles=String("admin,user")
Description = reject or confirm(and set roles) user by admin
roles = admin
Response = {"result":true/false,"message":"error message if result is false"}
Error Messages ="wrong status"
"wrong role"
"db problem"
- pending users:path = /unconfirmed_users
params = -----
Description = return a list of users that havn't confirmed by admin yet
roles = admin
Response = {"result":true/false,"message":"error message if result is false",
"unconfirmedUsers" : [{"username":"arastoo","name":"arastoo","family":"aamel"},{"username":"naghi","name":"naghi","family":"mamoolu"}]}
Error Messages ="db problem"
- user info : path = /user_info
params = -----
Description = return information of current logged in user
roles = admin,user
Response = {"result":true/false,"message":"error message if result is false",
"userInfo" : {"username":"admin","name":"admin","family":"adminy","roles":["admin","user"]} }
Error Messages ="db problem"
- add account : path = /add_account
params = username : String ,password=String
Description = add new social media account . like page in instagram
roles = admin
Response = {"result":true/false,"message":"error message if result is false"}
Error Messages ="wrong format or missing parameter"
"db problem"
"repeated username"
"server network problem"
"username or password of account is wrong"
"account has some problem.check or verify your account"
"some network problem with authentication server"
- accounts : path = /accounts
params = -----
Description = return list of all social account registered by admin
roles = admin,user
Response = {"result":true/false,"message":"error message if result is false",
"accounts":[{"username":"test"}] }
Error Messages ="db problem"
- reg post : path = /register_post
params = - media : uploaded file (set form enctype="multipart/form-data")
- accountUsername : String . account username which post is belong to .
- projectNameFa,projectNameEn,code,programFa,programEn,locationFa,locationEn,
architectFa,architectEn,year,size,projectStatusFa,projectStatusEn,descriptionFa,descriptionEn : String
- keywordsFa,keywordsEn : comma separated String
Description = register new post .
roles = user
Response = {"result":true/false,"message":"error message if result is false",
"post":{"id":10005,"creator":{"username":"admin"},"createdTime":1491957498541,
"status":"UNCONFIRMED","isEdited":false,"mediaType":"IMAGE","account":{"username":"test"},
"projectNameFa":"مجلس","projectNameEn":"WH","code":"WHP","programFa":"سری","programEn":"seri",
"locationFa":"تبریز","locationEn":"tabriz","architectFa":"خودم","architectEn":"myself","year":2014,
"size":121,"projectStatusFa":"تمام","projectStatusEn":"end",
"descriptionFa":"بیا برویم به ان دشت هایی که بسیرا زیباست",
"descriptionEn":"come with me to go to the beautiful lands","keywordsFa":"پشمکم,توموت,هوا",
"keywordsEn":"pash,tomtot,air"} }
Error Messages ="missing(empty) parameter"
"wrong format parameter"
"no account found with this username"
"db problem"
"uploaded file size exceeded the limit"
"uploaded file has wrong type.only image and video is acceptable"
"error in receiving uploaded file(bad config in client or server)"
* All times in get/set is in Timestamps wiht milliseconds .
- posts : path = /posts
params = - postStatus : optional parameter .comma seprated string which filter post based on theirs status
{CONFIRMED,REJECTED,UNCONFIRMED,POSTED,DELETED}
=ALL : all posts will be returned(except deleted posts)
="" or not declared : all posts will be returned(except deleted posts)
={ALL,DELETED} : all posts will be returned
- allUsers : optional parameter .if this param equals true then all posts of all users (with postStatus filter)
will be returned (require admin role).otherwise posts of logged in user will be returned.
Description = get posts of logged in user
roles = user,admin (allUsers=true : only admin)
Response = {"result":true/false,"message":"error message if result is false",
"posts":[{"id":10005,"creator":{"username":"taher"},"createdTime":1488813424000,"releaseTime":1491947482000,
"status":"UNCONFIRMED","isEdited":true,"editNote":"ridi2","mediaType":"IMAGE","mediaWebUrl":"img/test/10005_Screen.png",
"account":{"username":"test2"},"projectNameFa":"مجلس2","projectNameEn":"WH2","code":"WHP2","programFa":"سری2",
"programEn":"seri2","locationFa":"تبریز2","locationEn":"tabriz2","architectFa":"خودم2","architectEn":"myself2",
"year":20142,"size":1212,"projectStatusFa":"تمام2","projectStatusEn":"end2","descriptionFa":"بیاه",
"descriptionEn":"come ","keywordsFa":"پشمکم,توموت,هوا2","keywordsEn":"pash,tomtot,air2"}] }
Error Messages ="bad config in server"
"db problem"
"wrong value of post status"
- delete post : path = /delete_post
params = id : id of post
Description = delete post by it's id
roles = user,admin (admin can delete all posts. user can only delete his/her posts)
Response = {"result":true/false,"message":"error message if result is false"}
Error Messages ="wrong format or missing parameter"
"db problem"
"wrong id"
"it's not your post babe"
- edit post : path = /edit_post
params = - id : necessary. id(int) of post which you want to edit
- releaseTime(in timestamps), editNote: optional. only admin can edit this fields
- media,accountUsername,projectNameFa,projectNameEn,code,programFa,
programEn,locationFa,locationEn,architectFa,architectEn,year,size,
projectStatusFa,projectStatusEn,descriptionFa,descriptionEn,
keywordsFa,keywordsEn: optional. admin/user can edit this fields
Description = edit a post with it's id. id is necessary and other existed fileds in the request will be edited.
roles = user/admin
Response = json of post with eidted fields.json is like the one in register_post
Error Messages ="wrong format or missing parameter"
"it's not your post babe"
"wrong id"
"no account found with this username"
"db problem"
"uploaded file size exceeded the limit"
"uploaded file has wrong type.only image and video is acceptable"
"error in receiving uploaded file(bad config in client or server)"
"only admin can change post release time"
"only admin can change post edit note"
"Server Internal Error"
- post status : path = /specify_post_status
params = - id : necessary. id(int) of post which you want to reject/confirm it.
- status : necessary. "confirm" or "reject".
- releaseTime : necessary if status is "confirm". in timestamps.
- editNote : optional string if status is "reject".
Description = confirm/reject a post by admin
roles = admin
Response = {"result":true/false,"message":"error message if result is false"}
Error Messages ="wrong format or missing parameter" -> (id, releaseTime)
"wrong id"
"db problem"
"missing(empty) parameter" -> (status)
"wrong status"