Advertisement
Guest User

spec.yaml

a guest
Apr 21st, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.02 KB | None | 0 0
  1. ---
  2. openapi: 3.0.0
  3.  
  4. info:
  5. title: Mobis API Specification
  6. version: 1.0.0
  7.  
  8. servers:
  9. - url: "http://mobis.dbkl.gov.my/MobileWebApiDev/api/v1"
  10. - url: "{scheme}://{hostname}:{port}{basePath}"
  11. variables:
  12. hostname:
  13. default: localhost
  14. scheme:
  15. enum:
  16. - http
  17. - https
  18. default: http
  19. port:
  20. enum:
  21. - "443"
  22. - "80"
  23. - "1234"
  24. default: "1234"
  25. basePath:
  26. default: /api/v1
  27.  
  28. paths:
  29. "/users/me":
  30. get:
  31. security:
  32. - bearerAuth: []
  33. tags:
  34. - users
  35. summary: Get current user detail
  36. responses:
  37. '200':
  38. description: Current user detail
  39. content:
  40. application/json:
  41. schema:
  42. "$ref": "#/components/schemas/User"
  43. "401":
  44. description: Unauthorized
  45. content:
  46. application/json:
  47. "$ref": "#/components/schemas/ErrorMessage"
  48. put:
  49. security:
  50. - bearerAuth: []
  51. summary: Update current user detail (Full)
  52. tags:
  53. - users
  54. requestBody:
  55. required: true
  56. content:
  57. application/json:
  58. schema:
  59. "$ref": "#/components/schemas/UserUpdate"
  60. responses:
  61. '200':
  62. description: Updated user detail
  63. content:
  64. application/json:
  65. schema:
  66. "$ref": "#/components/schemas/User"
  67. '400':
  68. description: Failed to update user
  69. content:
  70. application/json:
  71. "$ref": "#/components/schemas/ErrorMessage"
  72. "401":
  73. description: Unauthorized
  74. content:
  75. application/json:
  76. "$ref": "#/components/schemas/ErrorMessage"
  77. patch:
  78. security:
  79. - bearerAuth: []
  80. summary: Patch current partial user detail (Partial)
  81. tags:
  82. - users
  83. requestBody:
  84. required: true
  85. content:
  86. application/json:
  87. schema:
  88. "$ref": "#/components/schemas/UserPatch"
  89. responses:
  90. '200':
  91. description: Updated user detail
  92. content:
  93. application/json:
  94. schema:
  95. "$ref": "#/components/schemas/User"
  96. '400':
  97. description: Failed to update user
  98. content:
  99. application/json:
  100. "$ref": "#/components/schemas/ErrorMessage"
  101. "401":
  102. description: Unauthorized
  103. content:
  104. application/json:
  105. "$ref": "#/components/schemas/ErrorMessage"
  106.  
  107. "/users":
  108. post:
  109. summary: Create a user
  110. tags:
  111. - users
  112. requestBody:
  113. required: true
  114. content:
  115. application/json:
  116. schema:
  117. "$ref": "#/components/schemas/UserCreate"
  118. responses:
  119. '201':
  120. description: Successfully registered user
  121. content:
  122. application/json:
  123. schema:
  124. "$ref": "#/components/schemas/User"
  125.  
  126. "/sessions":
  127. post:
  128. summary: Create a new session or exchange a refresh token for a new session
  129. tags:
  130. - users
  131. requestBody:
  132. required: true
  133. content:
  134. application/json:
  135. schema:
  136. oneOf:
  137. - "$ref": "#/components/schemas/SessionCreate"
  138. - "$ref": "#/components/schemas/SessionExchange"
  139. responses:
  140. '201':
  141. description: Session successfully created
  142. content:
  143. application/json:
  144. schema:
  145. "$ref": "#/components/schemas/Session"
  146. '400':
  147. description: Failed to create session
  148. content:
  149. application/json:
  150. "$ref": "#/components/schemas/ErrorMessage"
  151.  
  152. "/recoveries":
  153. post:
  154. summary: Recover a user
  155. tags:
  156. - users
  157. requestBody:
  158. required: true
  159. content:
  160. application/json:
  161. schema:
  162. "$ref": "#/components/schemas/RecoveryCreate"
  163. responses:
  164. '201':
  165. description: Recovery initiated
  166. content:
  167. application/json:
  168. schema:
  169. type: object
  170. properties:
  171. message:
  172. type: string
  173. description: A message to tell user of what to do next
  174. '400':
  175. description: Failed to recover user
  176. content:
  177. application/json:
  178. "$ref": "#/components/schemas/ErrorMessage"
  179.  
  180. "/recoveries/{code}":
  181. patch:
  182. summary: Use recovery code to recover user
  183. tags:
  184. - users
  185. parameters:
  186. - in: path
  187. name: code
  188. required: true
  189. schema:
  190. type: string
  191. description: The recovery code
  192. requestBody:
  193. required: true
  194. content:
  195. application/json:
  196. schema:
  197. "$ref": "#/components/schemas/RecoveryUsage"
  198. responses:
  199. '200':
  200. description: User detail
  201. content:
  202. application/json:
  203. schema:
  204. "$ref": "#/components/schemas/User"
  205. "400":
  206. description: Invalid
  207. content:
  208. application/json:
  209. "$ref": "#/components/schemas/ErrorMessage"
  210.  
  211. "/announcements":
  212. get:
  213. security:
  214. - bearerAuth: []
  215. summary: List announcements
  216. tags:
  217. - announcements
  218. responses:
  219. '204':
  220. description: Empty list of announcements
  221. '200':
  222. description: A list of announcements
  223. content:
  224. application/json:
  225. schema:
  226. type: array
  227. items:
  228. "$ref": "#/components/schemas/Announcement"
  229. "401":
  230. description: Unauthorized
  231. content:
  232. application/json:
  233. "$ref": "#/components/schemas/ErrorMessage"
  234.  
  235. "/compounds":
  236. get:
  237. summary: List compounds
  238. security:
  239. - bearerAuth: []
  240. tags:
  241. - compounds
  242. parameters:
  243. - in: query
  244. name: ic_number
  245. schema:
  246. type: string
  247. description: Nombor IC / IC number
  248. required: true
  249. - in: query
  250. name: vehicle_number
  251. schema:
  252. type: string
  253. description: Nombor kenderaan / Vehicle number
  254. required: true
  255. responses:
  256. '200':
  257. description: A list of compounds
  258. content:
  259. application/json:
  260. schema:
  261. type: array
  262. items:
  263. "$ref": "#/components/schemas/Compound"
  264. '400':
  265. description: Validation error
  266. content:
  267. application/json:
  268. schema:
  269. "$ref": "#/components/schemas/ErrorMessage"
  270. "401":
  271. description: Unauthorized
  272. content:
  273. application/json:
  274. schema:
  275. "$ref": "#/components/schemas/ErrorMessage"
  276.  
  277.  
  278. "/compounds/{number}":
  279. get:
  280. summary: Show compound
  281. security:
  282. - bearerAuth: []
  283. tags:
  284. - compounds
  285. parameters:
  286. - in: path
  287. name: number
  288. required: true
  289. schema:
  290. type: string
  291. description: The compound number
  292. responses:
  293. '200':
  294. description: A list of compounds
  295. content:
  296. application/json:
  297. "$ref": "#/components/schemas/CompoundDetail"
  298. '400':
  299. description: Validation error
  300. content:
  301. application/json:
  302. "$ref": "#/components/schemas/ErrorMessage"
  303. "401":
  304. description: Unauthorized
  305. content:
  306. application/json:
  307. "$ref": "#/components/schemas/ErrorMessage"
  308.  
  309. "/compound_payments":
  310. post:
  311. security:
  312. - bearerAuth: []
  313. tags:
  314. - compounds
  315. summary: Create a payment for compounds
  316. requestBody:
  317. required: true
  318. content:
  319. application/json:
  320. schema:
  321. "$ref": "#/components/schemas/CompoundPaymentCreate"
  322. responses:
  323. "201":
  324. description: Successfully created payment resource to be charged
  325. content:
  326. application/json:
  327. schema:
  328. "$ref": "#/components/schemas/CompoundPayment"
  329. "401":
  330. description: Unauthorized
  331. content:
  332. application/json:
  333. "$ref": "#/components/schemas/ErrorMessage"
  334.  
  335. "/receipts":
  336. get:
  337. security:
  338. - bearerAuth: []
  339. tags:
  340. - receipts
  341. summary: List receipts
  342. responses:
  343. "200":
  344. description: A list of receipts
  345. content:
  346. application/json:
  347. schema:
  348. type: array
  349. items:
  350. "$ref": "#/components/schemas/Receipt"
  351. "401":
  352. description: Unauthorized
  353. content:
  354. application/json:
  355. schema:
  356. "$ref": "#/components/schemas/ErrorMessage"
  357.  
  358. "/receipts/{id}":
  359. get:
  360. parameters:
  361. - in: path
  362. name: id
  363. required: true
  364. schema:
  365. type: string
  366. description: The receipt ID
  367. tags:
  368. - receipts
  369. security:
  370. - bearerAuth: []
  371. summary: Get receipt
  372. responses:
  373. "200":
  374. description: Show receipt
  375. content:
  376. application/json:
  377. schema:
  378. "$ref": "#/components/schemas/Receipt"
  379. "404":
  380. description: Not found
  381. content:
  382. application/json:
  383. "$ref": "#/components/schemas/ErrorMessage"
  384. "401":
  385. description: Unauthorized
  386. content:
  387. application/json:
  388. "$ref": "#/components/schemas/ErrorMessage"
  389.  
  390. "/receipts/{id}/resend":
  391. post:
  392. parameters:
  393. - in: path
  394. name: id
  395. required: true
  396. schema:
  397. type: string
  398. description: The receipt ID
  399. tags:
  400. - receipts
  401. security:
  402. - bearerAuth: []
  403. summary: Resend receipt to email
  404. responses:
  405. "201":
  406. description: Receipt resent
  407. content:
  408. application/json:
  409. schema:
  410. type: object
  411. properties:
  412. message:
  413. type: string
  414. description: A message to tell user of what to do next
  415.  
  416. "/assessments/{id}":
  417. get:
  418. parameters:
  419. - in: path
  420. name: id
  421. required: true
  422. schema:
  423. type: string
  424. description: The assessment ID
  425. tags:
  426. - assessments
  427. security:
  428. - bearerAuth: []
  429. summary: Show assessment detail
  430. responses:
  431. "200":
  432. description: Receipt resent
  433. content:
  434. application/json:
  435. schema:
  436. type: object
  437. properties:
  438. message:
  439. type: string
  440. description: A message to tell user of what to do next
  441.  
  442. "/license":
  443. get:
  444. parameters:
  445. - in: path
  446. name: license_file_num
  447. required: true
  448. schema:
  449. type: string
  450. description: The License File number
  451. - in: path
  452. name: id_type
  453. required: true
  454. schema:
  455. type: string
  456. description: ID Type Associated with the License
  457. - in: path
  458. name: id_number
  459. required: true
  460. schema:
  461. type: string
  462. description: ID Number associated with the License
  463. tags:
  464. - License
  465. security:
  466. - bearerAuth: []
  467. summary: Get license detail
  468.  
  469. components:
  470. schemas:
  471. User:
  472. title: User
  473. type: object
  474. properties:
  475. id:
  476. type: string
  477. description: User ID
  478. full_name:
  479. type: string
  480. description: Nama penuh / Full name
  481. ic_type:
  482. type: string
  483. description: Jenis Kad Pengenalan / Type of IC
  484. ic_number:
  485. type: string
  486. description: Nombor Kad Pengenalan / IC number
  487. email:
  488. type: string
  489. description: Emel / Email
  490. phone_number:
  491. type: string
  492. description: Phone number / Nombor telefon
  493.  
  494. UserCreate:
  495. title: UserCreate
  496. type: object
  497. properties:
  498. full_name:
  499. type: string
  500. description: Nama penuh / Full name
  501. ic_type:
  502. type: string
  503. description: Jenis Kad Pengenalan / Type of IC
  504. ic_number:
  505. type: string
  506. description: Nombor Kad Pengenalan / IC number
  507. email:
  508. type: string
  509. description: Emel / Email
  510. password:
  511. type: string
  512. description: Alphanumeric password with minimum length of 8
  513. phone_number:
  514. type: string
  515. description: Phone number / Nombor telefon
  516. required:
  517. - full_name
  518. - ic_type
  519. - ic_number
  520. - email
  521. - phone_number
  522. - password
  523.  
  524. UserUpdate:
  525. title: UserUpdate
  526. type: object
  527. properties:
  528. full_name:
  529. type: string
  530. description: Nama penuh / Full name
  531. ic_type:
  532. type: string
  533. description: Jenis Kad Pengenalan / Type of IC
  534. ic_number:
  535. type: string
  536. description: Nombor Kad Pengenalan / IC number
  537. email:
  538. type: string
  539. description: Emel / Email
  540. password:
  541. type: string
  542. description: Alphanumeric password with minimum length of 8
  543. phone_number:
  544. type: string
  545. description: Phone number / Nombor telefon
  546. required:
  547. - full_name
  548. - ic_type
  549. - ic_number
  550. - email
  551. - phone_number
  552. - password
  553.  
  554. UserPatch:
  555. title: UserPatch
  556. type: object
  557. properties:
  558. full_name:
  559. type: string
  560. description: Nama penuh / Full name
  561. ic_type:
  562. type: string
  563. description: Jenis Kad Pengenalan / Type of IC
  564. ic_number:
  565. type: string
  566. description: Nombor Kad Pengenalan / IC number
  567. email:
  568. type: string
  569. description: Emel / Email
  570. phone_number:
  571. type: string
  572. description: Phone number / Nombor telefon
  573. password:
  574. type: string
  575. description: Alphanumeric password with minimum length of 8
  576.  
  577. RecoveryCreate:
  578. title: RecoveryCreate
  579. type: object
  580. properties:
  581. ic_number:
  582. type: string
  583. description: IC number to recover account
  584. required:
  585. - ic_number
  586.  
  587. Session:
  588. title: Session
  589. type: object
  590. properties:
  591. access_token:
  592. type: string
  593. description: Bearer token, used to authenticate requests. Token expires
  594. when time is past the expiry_date. Can be refreshed using refresh_token
  595. refresh_token:
  596. type: string
  597. description: Refresh token, used to refresh the current session before expiry.
  598. Can only be used once and expires when time is past the expiry date
  599. expires_at:
  600. type: string
  601. format: date-time
  602. description: Token expiry datetime in ISO 8601 format in GMT+8
  603.  
  604. RecoveryUsage:
  605. title: RecoveryUsage
  606. type: object
  607. properties:
  608. ic_number:
  609. type: string
  610. description: Nombor Kad Pengenalan / IC number
  611. password:
  612. type: string
  613. description: Alphanumeric password with minimum length of 8
  614. required:
  615. - ic_number
  616. - password
  617.  
  618. SessionCreate:
  619. title: SessionCreate
  620. type: object
  621. properties:
  622. grant_type:
  623. type: string
  624. value: [password, refresh_token]
  625. ic_number:
  626. type: string
  627. description: Nombor IC / IC number
  628. password:
  629. type: string
  630. description: User password
  631. required:
  632. - grant_type
  633. - ic_number
  634. - password
  635.  
  636. SessionExchange:
  637. title: SessionExchange
  638. type: object
  639. properties:
  640. grant_type:
  641. type: string
  642. value: [password, refresh_token]
  643. refresh_token:
  644. type: string
  645. description: The refresh token needed to create a new session
  646. required:
  647. - grant_type
  648. - refresh_token
  649.  
  650. Announcement:
  651. title: Announcement
  652. type: object
  653. properties:
  654. id:
  655. type: string
  656. description: "ID Pengumuman / Announcement ID"
  657. title:
  658. type: string
  659. description: "Tajuk / Title"
  660. description:
  661. type: string
  662. description: "Huraian / Description"
  663. image_url:
  664. type: string
  665. description: "Gambar / Image"
  666.  
  667. ErrorMessage:
  668. title: ErrorMessage
  669. type: object
  670. properties:
  671. message:
  672. type: string
  673. description: User friendly message
  674.  
  675. Compound:
  676. title: Compound
  677. type: object
  678. properties:
  679. id:
  680. type: string
  681. description: ID kompaun / Compound ID
  682. number:
  683. type: string
  684. description: Nombor kompaun / Compound Number
  685. issued_at:
  686. type: string
  687. format: date-time
  688. description: ISO 8601 formatted date of compound issuance
  689. address:
  690. type: string
  691. description: Alamat / Address
  692. amount:
  693. type: integer
  694. description: "Harga Kompaun / Compound Amount. MUST BE IN CENTS"
  695.  
  696. CompoundDetail:
  697. title: CompoundDetail
  698. type: object
  699. properties:
  700. id:
  701. type: string
  702. description: ID kompaun / Compound ID
  703. number:
  704. type: string
  705. description: Nombor kompaun / Compound Number
  706. name:
  707. type: string
  708. description: Offender name
  709. ic_number:
  710. type: string
  711. vehicle_number:
  712. type: string
  713. offence_act:
  714. type: string
  715. offence_section:
  716. type: string
  717. offence_description:
  718. type: string
  719. notice_status:
  720. type: string
  721. blacklist_status:
  722. type: boolean
  723. address:
  724. type: string
  725. issued_at:
  726. type: string
  727. format: date-time
  728. description: ISO 8601 formatted date of compound issuance
  729. amount:
  730. type: integer
  731. description: "Harga Kompaun / Compound Amount. MUST BE IN CENTS"
  732.  
  733. CompoundPaymentCreate:
  734. title: CompoundPaymentCreate
  735. type: object
  736. properties:
  737. compound_ids:
  738. type: array
  739. description: Compound IDs to be paid
  740. items:
  741. type: integer
  742.  
  743. CompoundPayment:
  744. title: CompoundPayment
  745. type: object
  746. properties:
  747. id:
  748. type: string
  749. description: Payment ID
  750. redirect_url:
  751. type: string
  752. description: A URL to redirect the user to. Typically the payment gateway. Presents only when payment status is pending.
  753. amount:
  754. type: integer
  755. description: Total chargable amount. Must be in cents
  756. compound_ids:
  757. type: array
  758. description: Compound IDs that are payable
  759. items:
  760. type: integer
  761. status:
  762. type: string
  763. description: Payment status
  764. enum:
  765. - success
  766. - fail
  767. - void
  768. - pending
  769. receipt_id:
  770. type: string
  771. description: Presents only when payment status is success. Null otherwise
  772.  
  773. Receipt:
  774. title: Receipt
  775. type: object
  776. properties:
  777. id:
  778. type: string
  779. description: Receipt ID
  780. paid_at:
  781. type: string
  782. items:
  783. type: array
  784. items:
  785. type: object
  786. properties:
  787. title:
  788. type: string
  789. description: Item title
  790. amount:
  791. type: string
  792. description: Item amount. MUST BE IN CENTS
  793. subtotal_amount:
  794. type: integer
  795. description: Subtotal amount
  796. total_amount:
  797. type: integer
  798. description: Total amount
  799.  
  800. securitySchemes:
  801. bearerAuth:
  802. type: http
  803. scheme: bearer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement