users.json 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. {
  2. "$schema": "http://json-schema.org/draft-07/schema#",
  3. "$id": "endpoints/users",
  4. "title": "Users",
  5. "description": "Endpoints relating to Users",
  6. "stability": "stable",
  7. "type": "object",
  8. "definitions": {
  9. "id": {
  10. "$ref": "../definitions.json#/definitions/id"
  11. },
  12. "created_on": {
  13. "$ref": "../definitions.json#/definitions/created_on"
  14. },
  15. "modified_on": {
  16. "$ref": "../definitions.json#/definitions/modified_on"
  17. },
  18. "name": {
  19. "description": "Name",
  20. "example": "Jamie Curnow",
  21. "type": "string",
  22. "minLength": 2,
  23. "maxLength": 100
  24. },
  25. "nickname": {
  26. "description": "Nickname",
  27. "example": "Jamie",
  28. "type": "string",
  29. "minLength": 2,
  30. "maxLength": 50
  31. },
  32. "email": {
  33. "$ref": "../definitions.json#/definitions/email"
  34. },
  35. "avatar": {
  36. "description": "Avatar",
  37. "example": "http://somewhere.jpg",
  38. "type": "string",
  39. "minLength": 2,
  40. "maxLength": 150,
  41. "readOnly": true
  42. },
  43. "roles": {
  44. "description": "Roles",
  45. "example": [
  46. "admin"
  47. ],
  48. "type": "array"
  49. },
  50. "is_disabled": {
  51. "description": "Is Disabled",
  52. "example": false,
  53. "type": "boolean"
  54. }
  55. },
  56. "links": [
  57. {
  58. "title": "List",
  59. "description": "Returns a list of Users",
  60. "href": "/users",
  61. "access": "private",
  62. "method": "GET",
  63. "rel": "self",
  64. "http_header": {
  65. "$ref": "../examples.json#/definitions/auth_header"
  66. },
  67. "targetSchema": {
  68. "type": "array",
  69. "items": {
  70. "$ref": "#/properties"
  71. }
  72. }
  73. },
  74. {
  75. "title": "Create",
  76. "description": "Creates a new User",
  77. "href": "/users",
  78. "access": "private",
  79. "method": "POST",
  80. "rel": "create",
  81. "http_header": {
  82. "$ref": "../examples.json#/definitions/auth_header"
  83. },
  84. "schema": {
  85. "type": "object",
  86. "required": [
  87. "name",
  88. "nickname",
  89. "email"
  90. ],
  91. "properties": {
  92. "name": {
  93. "$ref": "#/definitions/name"
  94. },
  95. "nickname": {
  96. "$ref": "#/definitions/nickname"
  97. },
  98. "email": {
  99. "$ref": "#/definitions/email"
  100. },
  101. "roles": {
  102. "$ref": "#/definitions/roles"
  103. },
  104. "is_disabled": {
  105. "$ref": "#/definitions/is_disabled"
  106. },
  107. "auth": {
  108. "type": "object",
  109. "description": "Auth Credentials",
  110. "example": {
  111. "type": "password",
  112. "secret": "bigredhorsebanana"
  113. }
  114. }
  115. }
  116. },
  117. "targetSchema": {
  118. "properties": {
  119. "$ref": "#/properties"
  120. }
  121. }
  122. },
  123. {
  124. "title": "Update",
  125. "description": "Updates a existing User",
  126. "href": "/users/{definitions.identity.example}",
  127. "access": "private",
  128. "method": "PUT",
  129. "rel": "update",
  130. "http_header": {
  131. "$ref": "../examples.json#/definitions/auth_header"
  132. },
  133. "schema": {
  134. "type": "object",
  135. "properties": {
  136. "name": {
  137. "$ref": "#/definitions/name"
  138. },
  139. "nickname": {
  140. "$ref": "#/definitions/nickname"
  141. },
  142. "email": {
  143. "$ref": "#/definitions/email"
  144. },
  145. "roles": {
  146. "$ref": "#/definitions/roles"
  147. },
  148. "is_disabled": {
  149. "$ref": "#/definitions/is_disabled"
  150. }
  151. }
  152. },
  153. "targetSchema": {
  154. "properties": {
  155. "$ref": "#/properties"
  156. }
  157. }
  158. },
  159. {
  160. "title": "Delete",
  161. "description": "Deletes a existing User",
  162. "href": "/users/{definitions.identity.example}",
  163. "access": "private",
  164. "method": "DELETE",
  165. "rel": "delete",
  166. "http_header": {
  167. "$ref": "../examples.json#/definitions/auth_header"
  168. },
  169. "targetSchema": {
  170. "type": "boolean"
  171. }
  172. },
  173. {
  174. "title": "Set Password",
  175. "description": "Sets a password for an existing User",
  176. "href": "/users/{definitions.identity.example}/auth",
  177. "access": "private",
  178. "method": "PUT",
  179. "rel": "update",
  180. "http_header": {
  181. "$ref": "../examples.json#/definitions/auth_header"
  182. },
  183. "schema": {
  184. "type": "object",
  185. "required": [
  186. "type",
  187. "secret"
  188. ],
  189. "properties": {
  190. "type": {
  191. "type": "string",
  192. "pattern": "^password$"
  193. },
  194. "current": {
  195. "type": "string",
  196. "minLength": 1,
  197. "maxLength": 64
  198. },
  199. "secret": {
  200. "type": "string",
  201. "minLength": 8,
  202. "maxLength": 64
  203. }
  204. }
  205. },
  206. "targetSchema": {
  207. "type": "boolean"
  208. }
  209. },
  210. {
  211. "title": "Set Permissions",
  212. "description": "Sets Permissions for a User",
  213. "href": "/users/{definitions.identity.example}/permissions",
  214. "access": "private",
  215. "method": "PUT",
  216. "rel": "update",
  217. "http_header": {
  218. "$ref": "../examples.json#/definitions/auth_header"
  219. },
  220. "schema": {
  221. "type": "object",
  222. "properties": {
  223. "visibility": {
  224. "type": "string",
  225. "pattern": "^(all|user)$"
  226. },
  227. "access_lists": {
  228. "type": "string",
  229. "pattern": "^(hidden|view|manage)$"
  230. },
  231. "dead_hosts": {
  232. "type": "string",
  233. "pattern": "^(hidden|view|manage)$"
  234. },
  235. "proxy_hosts": {
  236. "type": "string",
  237. "pattern": "^(hidden|view|manage)$"
  238. },
  239. "redirection_hosts": {
  240. "type": "string",
  241. "pattern": "^(hidden|view|manage)$"
  242. },
  243. "streams": {
  244. "type": "string",
  245. "pattern": "^(hidden|view|manage)$"
  246. },
  247. "certificates": {
  248. "type": "string",
  249. "pattern": "^(hidden|view|manage)$"
  250. }
  251. }
  252. },
  253. "targetSchema": {
  254. "type": "boolean"
  255. }
  256. }
  257. ],
  258. "properties": {
  259. "id": {
  260. "$ref": "#/definitions/id"
  261. },
  262. "created_on": {
  263. "$ref": "#/definitions/created_on"
  264. },
  265. "modified_on": {
  266. "$ref": "#/definitions/modified_on"
  267. },
  268. "name": {
  269. "$ref": "#/definitions/name"
  270. },
  271. "nickname": {
  272. "$ref": "#/definitions/nickname"
  273. },
  274. "email": {
  275. "$ref": "#/definitions/email"
  276. },
  277. "avatar": {
  278. "$ref": "#/definitions/avatar"
  279. },
  280. "roles": {
  281. "$ref": "#/definitions/roles"
  282. },
  283. "is_disabled": {
  284. "$ref": "#/definitions/is_disabled"
  285. }
  286. }
  287. }