You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1053 lines
47 KiB

  1. {
  2. "openapi": "3.0.3",
  3. "info": {
  4. "title": "federation-full",
  5. "version": "0.0.1",
  6. "description": "Federation allows you to connect with other trusted servers to exchange the account directory.",
  7. "license": {
  8. "name": "agpl"
  9. }
  10. },
  11. "components": {
  12. "securitySchemes": {
  13. "basic_auth": {
  14. "type": "http",
  15. "scheme": "basic"
  16. },
  17. "bearer_auth": {
  18. "type": "http",
  19. "scheme": "bearer"
  20. }
  21. },
  22. "schemas": {
  23. "OCSMeta": {
  24. "type": "object",
  25. "required": [
  26. "status",
  27. "statuscode"
  28. ],
  29. "properties": {
  30. "status": {
  31. "type": "string"
  32. },
  33. "statuscode": {
  34. "type": "integer"
  35. },
  36. "message": {
  37. "type": "string"
  38. },
  39. "totalitems": {
  40. "type": "string"
  41. },
  42. "itemsperpage": {
  43. "type": "string"
  44. }
  45. }
  46. }
  47. }
  48. },
  49. "paths": {
  50. "/ocs/v2.php/apps/federation/api/v1/shared-secret": {
  51. "get": {
  52. "operationId": "ocs_authapi-get-shared-secret-legacy",
  53. "summary": "Create shared secret and return it, for legacy end-points",
  54. "tags": [
  55. "ocs_authapi"
  56. ],
  57. "security": [
  58. {},
  59. {
  60. "bearer_auth": []
  61. },
  62. {
  63. "basic_auth": []
  64. }
  65. ],
  66. "parameters": [
  67. {
  68. "name": "url",
  69. "in": "query",
  70. "description": "URL of the server",
  71. "required": true,
  72. "schema": {
  73. "type": "string"
  74. }
  75. },
  76. {
  77. "name": "token",
  78. "in": "query",
  79. "description": "Token of the server",
  80. "required": true,
  81. "schema": {
  82. "type": "string"
  83. }
  84. },
  85. {
  86. "name": "OCS-APIRequest",
  87. "in": "header",
  88. "description": "Required to be true for the API request to pass",
  89. "required": true,
  90. "schema": {
  91. "type": "boolean",
  92. "default": true
  93. }
  94. }
  95. ],
  96. "responses": {
  97. "200": {
  98. "description": "Shared secret returned",
  99. "content": {
  100. "application/json": {
  101. "schema": {
  102. "type": "object",
  103. "required": [
  104. "ocs"
  105. ],
  106. "properties": {
  107. "ocs": {
  108. "type": "object",
  109. "required": [
  110. "meta",
  111. "data"
  112. ],
  113. "properties": {
  114. "meta": {
  115. "$ref": "#/components/schemas/OCSMeta"
  116. },
  117. "data": {
  118. "type": "object",
  119. "required": [
  120. "sharedSecret"
  121. ],
  122. "properties": {
  123. "sharedSecret": {
  124. "type": "string"
  125. }
  126. }
  127. }
  128. }
  129. }
  130. }
  131. }
  132. }
  133. }
  134. },
  135. "403": {
  136. "description": "Getting shared secret is not allowed",
  137. "content": {
  138. "application/json": {
  139. "schema": {
  140. "type": "object",
  141. "required": [
  142. "ocs"
  143. ],
  144. "properties": {
  145. "ocs": {
  146. "type": "object",
  147. "required": [
  148. "meta",
  149. "data"
  150. ],
  151. "properties": {
  152. "meta": {
  153. "$ref": "#/components/schemas/OCSMeta"
  154. },
  155. "data": {}
  156. }
  157. }
  158. }
  159. }
  160. }
  161. }
  162. }
  163. }
  164. }
  165. },
  166. "/ocs/v2.php/apps/federation/api/v1/request-shared-secret": {
  167. "post": {
  168. "operationId": "ocs_authapi-request-shared-secret-legacy",
  169. "summary": "Request received to ask remote server for a shared secret, for legacy end-points",
  170. "tags": [
  171. "ocs_authapi"
  172. ],
  173. "security": [
  174. {},
  175. {
  176. "bearer_auth": []
  177. },
  178. {
  179. "basic_auth": []
  180. }
  181. ],
  182. "requestBody": {
  183. "required": true,
  184. "content": {
  185. "application/json": {
  186. "schema": {
  187. "type": "object",
  188. "required": [
  189. "url",
  190. "token"
  191. ],
  192. "properties": {
  193. "url": {
  194. "type": "string",
  195. "description": "URL of the server"
  196. },
  197. "token": {
  198. "type": "string",
  199. "description": "Token of the server"
  200. }
  201. }
  202. }
  203. }
  204. }
  205. },
  206. "parameters": [
  207. {
  208. "name": "OCS-APIRequest",
  209. "in": "header",
  210. "description": "Required to be true for the API request to pass",
  211. "required": true,
  212. "schema": {
  213. "type": "boolean",
  214. "default": true
  215. }
  216. }
  217. ],
  218. "responses": {
  219. "200": {
  220. "description": "Shared secret requested successfully",
  221. "content": {
  222. "application/json": {
  223. "schema": {
  224. "type": "object",
  225. "required": [
  226. "ocs"
  227. ],
  228. "properties": {
  229. "ocs": {
  230. "type": "object",
  231. "required": [
  232. "meta",
  233. "data"
  234. ],
  235. "properties": {
  236. "meta": {
  237. "$ref": "#/components/schemas/OCSMeta"
  238. },
  239. "data": {}
  240. }
  241. }
  242. }
  243. }
  244. }
  245. }
  246. },
  247. "403": {
  248. "description": "Requesting shared secret is not allowed",
  249. "content": {
  250. "application/json": {
  251. "schema": {
  252. "type": "object",
  253. "required": [
  254. "ocs"
  255. ],
  256. "properties": {
  257. "ocs": {
  258. "type": "object",
  259. "required": [
  260. "meta",
  261. "data"
  262. ],
  263. "properties": {
  264. "meta": {
  265. "$ref": "#/components/schemas/OCSMeta"
  266. },
  267. "data": {}
  268. }
  269. }
  270. }
  271. }
  272. }
  273. }
  274. }
  275. }
  276. }
  277. },
  278. "/ocs/v2.php/cloud/shared-secret": {
  279. "get": {
  280. "operationId": "ocs_authapi-get-shared-secret",
  281. "summary": "Create shared secret and return it",
  282. "tags": [
  283. "ocs_authapi"
  284. ],
  285. "security": [
  286. {},
  287. {
  288. "bearer_auth": []
  289. },
  290. {
  291. "basic_auth": []
  292. }
  293. ],
  294. "parameters": [
  295. {
  296. "name": "url",
  297. "in": "query",
  298. "description": "URL of the server",
  299. "required": true,
  300. "schema": {
  301. "type": "string"
  302. }
  303. },
  304. {
  305. "name": "token",
  306. "in": "query",
  307. "description": "Token of the server",
  308. "required": true,
  309. "schema": {
  310. "type": "string"
  311. }
  312. },
  313. {
  314. "name": "OCS-APIRequest",
  315. "in": "header",
  316. "description": "Required to be true for the API request to pass",
  317. "required": true,
  318. "schema": {
  319. "type": "boolean",
  320. "default": true
  321. }
  322. }
  323. ],
  324. "responses": {
  325. "200": {
  326. "description": "Shared secret returned",
  327. "content": {
  328. "application/json": {
  329. "schema": {
  330. "type": "object",
  331. "required": [
  332. "ocs"
  333. ],
  334. "properties": {
  335. "ocs": {
  336. "type": "object",
  337. "required": [
  338. "meta",
  339. "data"
  340. ],
  341. "properties": {
  342. "meta": {
  343. "$ref": "#/components/schemas/OCSMeta"
  344. },
  345. "data": {
  346. "type": "object",
  347. "required": [
  348. "sharedSecret"
  349. ],
  350. "properties": {
  351. "sharedSecret": {
  352. "type": "string"
  353. }
  354. }
  355. }
  356. }
  357. }
  358. }
  359. }
  360. }
  361. }
  362. },
  363. "403": {
  364. "description": "Getting shared secret is not allowed",
  365. "content": {
  366. "application/json": {
  367. "schema": {
  368. "type": "object",
  369. "required": [
  370. "ocs"
  371. ],
  372. "properties": {
  373. "ocs": {
  374. "type": "object",
  375. "required": [
  376. "meta",
  377. "data"
  378. ],
  379. "properties": {
  380. "meta": {
  381. "$ref": "#/components/schemas/OCSMeta"
  382. },
  383. "data": {}
  384. }
  385. }
  386. }
  387. }
  388. }
  389. }
  390. }
  391. }
  392. },
  393. "post": {
  394. "operationId": "ocs_authapi-request-shared-secret",
  395. "summary": "Request received to ask remote server for a shared secret",
  396. "tags": [
  397. "ocs_authapi"
  398. ],
  399. "security": [
  400. {},
  401. {
  402. "bearer_auth": []
  403. },
  404. {
  405. "basic_auth": []
  406. }
  407. ],
  408. "requestBody": {
  409. "required": true,
  410. "content": {
  411. "application/json": {
  412. "schema": {
  413. "type": "object",
  414. "required": [
  415. "url",
  416. "token"
  417. ],
  418. "properties": {
  419. "url": {
  420. "type": "string",
  421. "description": "URL of the server"
  422. },
  423. "token": {
  424. "type": "string",
  425. "description": "Token of the server"
  426. }
  427. }
  428. }
  429. }
  430. }
  431. },
  432. "parameters": [
  433. {
  434. "name": "OCS-APIRequest",
  435. "in": "header",
  436. "description": "Required to be true for the API request to pass",
  437. "required": true,
  438. "schema": {
  439. "type": "boolean",
  440. "default": true
  441. }
  442. }
  443. ],
  444. "responses": {
  445. "200": {
  446. "description": "Shared secret requested successfully",
  447. "content": {
  448. "application/json": {
  449. "schema": {
  450. "type": "object",
  451. "required": [
  452. "ocs"
  453. ],
  454. "properties": {
  455. "ocs": {
  456. "type": "object",
  457. "required": [
  458. "meta",
  459. "data"
  460. ],
  461. "properties": {
  462. "meta": {
  463. "$ref": "#/components/schemas/OCSMeta"
  464. },
  465. "data": {}
  466. }
  467. }
  468. }
  469. }
  470. }
  471. }
  472. },
  473. "403": {
  474. "description": "Requesting shared secret is not allowed",
  475. "content": {
  476. "application/json": {
  477. "schema": {
  478. "type": "object",
  479. "required": [
  480. "ocs"
  481. ],
  482. "properties": {
  483. "ocs": {
  484. "type": "object",
  485. "required": [
  486. "meta",
  487. "data"
  488. ],
  489. "properties": {
  490. "meta": {
  491. "$ref": "#/components/schemas/OCSMeta"
  492. },
  493. "data": {}
  494. }
  495. }
  496. }
  497. }
  498. }
  499. }
  500. }
  501. }
  502. }
  503. },
  504. "/ocs/v2.php/apps/federation/trusted-servers": {
  505. "post": {
  506. "operationId": "settings-add-server",
  507. "summary": "Add server to the list of trusted Nextcloud servers",
  508. "description": "This endpoint requires admin access",
  509. "tags": [
  510. "settings"
  511. ],
  512. "security": [
  513. {
  514. "bearer_auth": []
  515. },
  516. {
  517. "basic_auth": []
  518. }
  519. ],
  520. "requestBody": {
  521. "required": true,
  522. "content": {
  523. "application/json": {
  524. "schema": {
  525. "type": "object",
  526. "required": [
  527. "url"
  528. ],
  529. "properties": {
  530. "url": {
  531. "type": "string",
  532. "description": "The URL of the server to add"
  533. }
  534. }
  535. }
  536. }
  537. }
  538. },
  539. "parameters": [
  540. {
  541. "name": "OCS-APIRequest",
  542. "in": "header",
  543. "description": "Required to be true for the API request to pass",
  544. "required": true,
  545. "schema": {
  546. "type": "boolean",
  547. "default": true
  548. }
  549. }
  550. ],
  551. "responses": {
  552. "200": {
  553. "description": "Server added successfully",
  554. "content": {
  555. "application/json": {
  556. "schema": {
  557. "type": "object",
  558. "required": [
  559. "ocs"
  560. ],
  561. "properties": {
  562. "ocs": {
  563. "type": "object",
  564. "required": [
  565. "meta",
  566. "data"
  567. ],
  568. "properties": {
  569. "meta": {
  570. "$ref": "#/components/schemas/OCSMeta"
  571. },
  572. "data": {
  573. "type": "object",
  574. "required": [
  575. "id",
  576. "message",
  577. "url"
  578. ],
  579. "properties": {
  580. "id": {
  581. "type": "integer",
  582. "format": "int64"
  583. },
  584. "message": {
  585. "type": "string"
  586. },
  587. "url": {
  588. "type": "string"
  589. }
  590. }
  591. }
  592. }
  593. }
  594. }
  595. }
  596. }
  597. }
  598. },
  599. "404": {
  600. "description": "Server not found at the given URL",
  601. "content": {
  602. "application/json": {
  603. "schema": {
  604. "type": "object",
  605. "required": [
  606. "ocs"
  607. ],
  608. "properties": {
  609. "ocs": {
  610. "type": "object",
  611. "required": [
  612. "meta",
  613. "data"
  614. ],
  615. "properties": {
  616. "meta": {
  617. "$ref": "#/components/schemas/OCSMeta"
  618. },
  619. "data": {
  620. "type": "object",
  621. "required": [
  622. "message"
  623. ],
  624. "properties": {
  625. "message": {
  626. "type": "string"
  627. }
  628. }
  629. }
  630. }
  631. }
  632. }
  633. }
  634. }
  635. }
  636. },
  637. "409": {
  638. "description": "Server is already in the list of trusted servers",
  639. "content": {
  640. "application/json": {
  641. "schema": {
  642. "type": "object",
  643. "required": [
  644. "ocs"
  645. ],
  646. "properties": {
  647. "ocs": {
  648. "type": "object",
  649. "required": [
  650. "meta",
  651. "data"
  652. ],
  653. "properties": {
  654. "meta": {
  655. "$ref": "#/components/schemas/OCSMeta"
  656. },
  657. "data": {
  658. "type": "object",
  659. "required": [
  660. "message"
  661. ],
  662. "properties": {
  663. "message": {
  664. "type": "string"
  665. }
  666. }
  667. }
  668. }
  669. }
  670. }
  671. }
  672. }
  673. }
  674. },
  675. "401": {
  676. "description": "Current user is not logged in",
  677. "content": {
  678. "application/json": {
  679. "schema": {
  680. "type": "object",
  681. "required": [
  682. "ocs"
  683. ],
  684. "properties": {
  685. "ocs": {
  686. "type": "object",
  687. "required": [
  688. "meta",
  689. "data"
  690. ],
  691. "properties": {
  692. "meta": {
  693. "$ref": "#/components/schemas/OCSMeta"
  694. },
  695. "data": {}
  696. }
  697. }
  698. }
  699. }
  700. }
  701. }
  702. },
  703. "403": {
  704. "description": "Logged in account must be an admin",
  705. "content": {
  706. "application/json": {
  707. "schema": {
  708. "type": "object",
  709. "required": [
  710. "ocs"
  711. ],
  712. "properties": {
  713. "ocs": {
  714. "type": "object",
  715. "required": [
  716. "meta",
  717. "data"
  718. ],
  719. "properties": {
  720. "meta": {
  721. "$ref": "#/components/schemas/OCSMeta"
  722. },
  723. "data": {}
  724. }
  725. }
  726. }
  727. }
  728. }
  729. }
  730. }
  731. }
  732. },
  733. "get": {
  734. "operationId": "settings-get-servers",
  735. "summary": "List all trusted servers",
  736. "description": "This endpoint requires admin access",
  737. "tags": [
  738. "settings"
  739. ],
  740. "security": [
  741. {
  742. "bearer_auth": []
  743. },
  744. {
  745. "basic_auth": []
  746. }
  747. ],
  748. "parameters": [
  749. {
  750. "name": "OCS-APIRequest",
  751. "in": "header",
  752. "description": "Required to be true for the API request to pass",
  753. "required": true,
  754. "schema": {
  755. "type": "boolean",
  756. "default": true
  757. }
  758. }
  759. ],
  760. "responses": {
  761. "200": {
  762. "description": "List of trusted servers",
  763. "content": {
  764. "application/json": {
  765. "schema": {
  766. "type": "object",
  767. "required": [
  768. "ocs"
  769. ],
  770. "properties": {
  771. "ocs": {
  772. "type": "object",
  773. "required": [
  774. "meta",
  775. "data"
  776. ],
  777. "properties": {
  778. "meta": {
  779. "$ref": "#/components/schemas/OCSMeta"
  780. },
  781. "data": {
  782. "type": "array",
  783. "items": {
  784. "type": "object",
  785. "required": [
  786. "id",
  787. "status",
  788. "url"
  789. ],
  790. "properties": {
  791. "id": {
  792. "type": "integer",
  793. "format": "int64"
  794. },
  795. "status": {
  796. "type": "integer",
  797. "format": "int64"
  798. },
  799. "url": {
  800. "type": "string"
  801. }
  802. }
  803. }
  804. }
  805. }
  806. }
  807. }
  808. }
  809. }
  810. }
  811. },
  812. "401": {
  813. "description": "Current user is not logged in",
  814. "content": {
  815. "application/json": {
  816. "schema": {
  817. "type": "object",
  818. "required": [
  819. "ocs"
  820. ],
  821. "properties": {
  822. "ocs": {
  823. "type": "object",
  824. "required": [
  825. "meta",
  826. "data"
  827. ],
  828. "properties": {
  829. "meta": {
  830. "$ref": "#/components/schemas/OCSMeta"
  831. },
  832. "data": {}
  833. }
  834. }
  835. }
  836. }
  837. }
  838. }
  839. },
  840. "403": {
  841. "description": "Logged in account must be an admin",
  842. "content": {
  843. "application/json": {
  844. "schema": {
  845. "type": "object",
  846. "required": [
  847. "ocs"
  848. ],
  849. "properties": {
  850. "ocs": {
  851. "type": "object",
  852. "required": [
  853. "meta",
  854. "data"
  855. ],
  856. "properties": {
  857. "meta": {
  858. "$ref": "#/components/schemas/OCSMeta"
  859. },
  860. "data": {}
  861. }
  862. }
  863. }
  864. }
  865. }
  866. }
  867. }
  868. }
  869. }
  870. },
  871. "/ocs/v2.php/apps/federation/trusted-servers/{id}": {
  872. "delete": {
  873. "operationId": "settings-remove-server",
  874. "summary": "Add server to the list of trusted Nextcloud servers",
  875. "description": "This endpoint requires admin access",
  876. "tags": [
  877. "settings"
  878. ],
  879. "security": [
  880. {
  881. "bearer_auth": []
  882. },
  883. {
  884. "basic_auth": []
  885. }
  886. ],
  887. "parameters": [
  888. {
  889. "name": "id",
  890. "in": "path",
  891. "description": "The ID of the trusted server to remove",
  892. "required": true,
  893. "schema": {
  894. "type": "integer",
  895. "format": "int64"
  896. }
  897. },
  898. {
  899. "name": "OCS-APIRequest",
  900. "in": "header",
  901. "description": "Required to be true for the API request to pass",
  902. "required": true,
  903. "schema": {
  904. "type": "boolean",
  905. "default": true
  906. }
  907. }
  908. ],
  909. "responses": {
  910. "200": {
  911. "description": "Server removed successfully",
  912. "content": {
  913. "application/json": {
  914. "schema": {
  915. "type": "object",
  916. "required": [
  917. "ocs"
  918. ],
  919. "properties": {
  920. "ocs": {
  921. "type": "object",
  922. "required": [
  923. "meta",
  924. "data"
  925. ],
  926. "properties": {
  927. "meta": {
  928. "$ref": "#/components/schemas/OCSMeta"
  929. },
  930. "data": {
  931. "type": "object",
  932. "required": [
  933. "id"
  934. ],
  935. "properties": {
  936. "id": {
  937. "type": "integer",
  938. "format": "int64"
  939. }
  940. }
  941. }
  942. }
  943. }
  944. }
  945. }
  946. }
  947. }
  948. },
  949. "404": {
  950. "description": "Server not found at the given ID",
  951. "content": {
  952. "application/json": {
  953. "schema": {
  954. "type": "object",
  955. "required": [
  956. "ocs"
  957. ],
  958. "properties": {
  959. "ocs": {
  960. "type": "object",
  961. "required": [
  962. "meta",
  963. "data"
  964. ],
  965. "properties": {
  966. "meta": {
  967. "$ref": "#/components/schemas/OCSMeta"
  968. },
  969. "data": {
  970. "type": "object",
  971. "required": [
  972. "message"
  973. ],
  974. "properties": {
  975. "message": {
  976. "type": "string"
  977. }
  978. }
  979. }
  980. }
  981. }
  982. }
  983. }
  984. }
  985. }
  986. },
  987. "401": {
  988. "description": "Current user is not logged in",
  989. "content": {
  990. "application/json": {
  991. "schema": {
  992. "type": "object",
  993. "required": [
  994. "ocs"
  995. ],
  996. "properties": {
  997. "ocs": {
  998. "type": "object",
  999. "required": [
  1000. "meta",
  1001. "data"
  1002. ],
  1003. "properties": {
  1004. "meta": {
  1005. "$ref": "#/components/schemas/OCSMeta"
  1006. },
  1007. "data": {}
  1008. }
  1009. }
  1010. }
  1011. }
  1012. }
  1013. }
  1014. },
  1015. "403": {
  1016. "description": "Logged in account must be an admin",
  1017. "content": {
  1018. "application/json": {
  1019. "schema": {
  1020. "type": "object",
  1021. "required": [
  1022. "ocs"
  1023. ],
  1024. "properties": {
  1025. "ocs": {
  1026. "type": "object",
  1027. "required": [
  1028. "meta",
  1029. "data"
  1030. ],
  1031. "properties": {
  1032. "meta": {
  1033. "$ref": "#/components/schemas/OCSMeta"
  1034. },
  1035. "data": {}
  1036. }
  1037. }
  1038. }
  1039. }
  1040. }
  1041. }
  1042. }
  1043. }
  1044. }
  1045. }
  1046. },
  1047. "tags": [
  1048. {
  1049. "name": "ocs_authapi",
  1050. "description": "Class OCSAuthAPI OCS API end-points to exchange shared secret between two connected Nextclouds"
  1051. }
  1052. ]
  1053. }