swagger.yaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. basePath: /
  2. consumes:
  3. - application/json
  4. host: netmaker.io
  5. info:
  6. description: |-
  7. API Usage
  8. Most actions that can be performed via API can be performed via UI. We recommend managing your networks using the official netmaker-ui project. However, Netmaker can also be run without the UI, and all functions can be achieved via API calls. If your use case requires using Netmaker without the UI or you need to do some troubleshooting/advanced configuration, using the API directly may help.
  9. Authentication
  10. API calls must be authenticated via a header of the format -H “Authorization: Bearer <YOUR_SECRET_KEY>” There are two methods to obtain YOUR_SECRET_KEY: 1. Using the masterkey. By default, this value is “secret key,” but you should change this on your instance and keep it secure. This value can be set via env var at startup or in a config file (config/environments/< env >.yaml). See the [Netmaker](https://docs.netmaker.org/index.html) documentation for more details. 2. Using a JWT received for a node. This can be retrieved by calling the /api/nodes/<network>/authenticate endpoint, as documented below.
  11. title: Netmaker
  12. version: 0.15.1
  13. paths:
  14. /api/dns:
  15. get:
  16. description: Gets all DNS entries
  17. operationId: getAllDNS
  18. schemes:
  19. - https
  20. tags:
  21. - dns
  22. /api/dns/{network}:
  23. post:
  24. description: Create a DNS entry
  25. operationId: createDNS
  26. schemes:
  27. - https
  28. tags:
  29. - dns
  30. /api/dns/{network}/{domain}:
  31. delete:
  32. description: Delete a DNS entry
  33. operationId: deleteDNS
  34. schemes:
  35. - https
  36. tags:
  37. - dns
  38. /api/dns/adm/{network}:
  39. get:
  40. description: Gets all DNS entries associated with the network
  41. operationId: getDNS
  42. schemes:
  43. - https
  44. tags:
  45. - dns
  46. /api/dns/adm/{network}/custom:
  47. get:
  48. description: Gets custom DNS entries associated with a network
  49. operationId: getCustomDNS
  50. schemes:
  51. - https
  52. tags:
  53. - dns
  54. /api/dns/adm/{network}/nodes:
  55. get:
  56. description: Gets node DNS entries associated with a network
  57. operationId: getNodeDNS
  58. schemes:
  59. - https
  60. tags:
  61. - dns
  62. /api/dns/adm/pushdns:
  63. post:
  64. description: Push DNS entries to nameserver
  65. operationId: pushDNS
  66. schemes:
  67. - https
  68. tags:
  69. - dns
  70. /api/extclients:
  71. get:
  72. operationId: getExtClient
  73. schemes:
  74. - https
  75. summary: Get an individual extclient.
  76. tags:
  77. - ext_client
  78. /api/extclients/{network}:
  79. get:
  80. description: |-
  81. Get all extclients associated with network
  82. Gets all extclients associated with network, including pending extclients
  83. operationId: getNetworkExtClients
  84. schemes:
  85. - https
  86. tags:
  87. - ext_client
  88. /api/extclients/{network}/{clientid}:
  89. delete:
  90. operationId: deleteExtClient
  91. schemes:
  92. - https
  93. summary: Delete an individual extclient.
  94. tags:
  95. - ext_client
  96. put:
  97. operationId: updateExtClient
  98. schemes:
  99. - https
  100. summary: Update an individual extclient.
  101. tags:
  102. - ext_client
  103. /api/extclients/{network}/{clientid}/{type}:
  104. get:
  105. operationId: getExtClientConf
  106. schemes:
  107. - https
  108. summary: Get an individual extclient.
  109. tags:
  110. - ext_client
  111. /api/extclients/{network}/{nodeid}:
  112. post:
  113. operationId: createExtClient
  114. schemes:
  115. - https
  116. summary: Create an individual extclient. Must have valid key and be unique.
  117. tags:
  118. - ext_client
  119. /api/getip:
  120. get:
  121. description: Get the current public IP address
  122. operationId: getPublicIP
  123. schemes:
  124. - https
  125. tags:
  126. - ipservice
  127. /api/networks:
  128. get:
  129. description: Get a network
  130. operationId: getNetwork
  131. schemes:
  132. - https
  133. tags:
  134. - networks
  135. post:
  136. description: Create a network
  137. operationId: createNetwork
  138. schemes:
  139. - https
  140. tags:
  141. - networks
  142. /api/networks/{networkname}:
  143. delete:
  144. operationId: deleteNetwork
  145. schemes:
  146. - https
  147. summary: Delete a network. Will not delete if there are any nodes that belong to the network.
  148. tags:
  149. - networks
  150. put:
  151. description: Update a network
  152. operationId: updateNetwork
  153. schemes:
  154. - https
  155. tags:
  156. - networks
  157. /api/networks/{networkname}/acls:
  158. get:
  159. operationId: getNetworkACL
  160. schemes:
  161. - https
  162. summary: Get a network ACL (Access Control List).
  163. tags:
  164. - networks
  165. put:
  166. operationId: updateNetworkACL
  167. schemes:
  168. - https
  169. summary: Update a network ACL (Access Control List).
  170. tags:
  171. - networks
  172. /api/networks/{networkname}/keys:
  173. get:
  174. operationId: getAccessKeys
  175. schemes:
  176. - https
  177. summary: Get network access keys for a network.
  178. tags:
  179. - networks
  180. post:
  181. operationId: createAccessKey
  182. schemes:
  183. - https
  184. summary: Create a network access key.
  185. tags:
  186. - networks
  187. /api/networks/{networkname}/keys/{name}:
  188. get:
  189. operationId: deleteAccessKey
  190. schemes:
  191. - https
  192. summary: Delete a network access key.
  193. tags:
  194. - networks
  195. /api/networks/{networkname}/keyupdate:
  196. post:
  197. operationId: keyUpdate
  198. schemes:
  199. - https
  200. summary: Update keys for a network.
  201. tags:
  202. - networks
  203. /api/networks/{networkname}/nodelimit:
  204. put:
  205. description: Update a network's node limit
  206. operationId: updateNetworkNodeLimit
  207. schemes:
  208. - https
  209. tags:
  210. - networks
  211. /api/nodes:
  212. get:
  213. operationId: getAllNodes
  214. schemes:
  215. - https
  216. summary: Get all nodes across all networks.
  217. tags:
  218. - nodes
  219. /api/nodes/{network}:
  220. get:
  221. description: Gets all nodes associated with network including pending nodes
  222. operationId: getNetworkNodes
  223. schemes:
  224. - https
  225. tags:
  226. - nodes
  227. post:
  228. operationId: createNode
  229. schemes:
  230. - https
  231. summary: Create a node on a network.
  232. tags:
  233. - nodes
  234. /api/nodes/{network}/{nodeid}:
  235. delete:
  236. operationId: deleteNode
  237. schemes:
  238. - https
  239. summary: Delete an individual node.
  240. tags:
  241. - nodes
  242. get:
  243. operationId: getNode
  244. schemes:
  245. - https
  246. summary: Get an individual node.
  247. tags:
  248. - nodes
  249. put:
  250. operationId: updateNode
  251. schemes:
  252. - https
  253. summary: Update an individual node.
  254. tags:
  255. - nodes
  256. /api/nodes/{network}/{nodeid}/approve:
  257. post:
  258. operationId: uncordonNode
  259. schemes:
  260. - https
  261. security:
  262. - TODO:
  263. - May
  264. summary: Takes a node out of pending state.
  265. tags:
  266. - nodes
  267. /api/nodes/{network}/{nodeid}/creategateway:
  268. post:
  269. operationId: createEgressGateway
  270. schemes:
  271. - https
  272. summary: Create an egress gateway.
  273. tags:
  274. - nodes
  275. /api/nodes/{network}/{nodeid}/createingress:
  276. post:
  277. operationId: createIngressGateway
  278. schemes:
  279. - https
  280. summary: Create an ingress gateway.
  281. tags:
  282. - nodes
  283. /api/nodes/{network}/{nodeid}/createrelay:
  284. post:
  285. operationId: createRelay
  286. schemes:
  287. - https
  288. summary: Create a relay.
  289. tags:
  290. - nodes
  291. /api/nodes/{network}/{nodeid}/deletegateway:
  292. delete:
  293. operationId: deleteEgressGateway
  294. schemes:
  295. - https
  296. summary: Delete an egress gateway.
  297. tags:
  298. - nodes
  299. /api/nodes/{network}/{nodeid}/deleteingress:
  300. delete:
  301. operationId: deleteIngressGateway
  302. schemes:
  303. - https
  304. summary: Delete an ingress gateway.
  305. tags:
  306. - nodes
  307. /api/nodes/{network}/{nodeid}/deleterelay:
  308. delete:
  309. operationId: deleteRelay
  310. schemes:
  311. - https
  312. summary: Remove a relay.
  313. tags:
  314. - nodes
  315. /api/nodes/adm/{network}/authenticate:
  316. post:
  317. operationId: authenticate
  318. schemes:
  319. - https
  320. summary: Authenticate to make further API calls related to a network.
  321. tags:
  322. - nodes
  323. /api/nodes/adm/{network}/lastmodified:
  324. get:
  325. operationId: getLastModified
  326. schemes:
  327. - https
  328. security:
  329. - TODO:
  330. - This
  331. - Potential way to do this:
  332. - "On"
  333. - set
  334. summary: Get the time that a network of nodes was last modified.
  335. tags:
  336. - nodes
  337. /api/oauth/login:
  338. get:
  339. description: Handles OAuth login
  340. operationId: HandleAuthLogin
  341. schemes:
  342. - https
  343. tags:
  344. - nodes
  345. /api/server/getconfig:
  346. get:
  347. operationId: getConfig
  348. schemes:
  349. - https
  350. summary: Get the server configuration.
  351. tags:
  352. - nodes
  353. /api/server/getserverinfo:
  354. get:
  355. operationId: getServerInfo
  356. schemes:
  357. - https
  358. summary: Get the server configuration.
  359. tags:
  360. - nodes
  361. /api/server/register:
  362. post:
  363. description: Registers a client with the server and return the Certificate Authority and certificate
  364. operationId: register
  365. schemes:
  366. - https
  367. tags:
  368. - nodes
  369. /api/server/removenetwork/{network}:
  370. delete:
  371. operationId: removeNetwork
  372. schemes:
  373. - https
  374. summary: Remove a network from the server.
  375. tags:
  376. - nodes
  377. /api/users:
  378. get:
  379. description: Get all users
  380. operationId: getUsers
  381. schemes:
  382. - https
  383. tags:
  384. - nodes
  385. /api/users/{username}:
  386. delete:
  387. operationId: deleteUser
  388. schemes:
  389. - https
  390. summary: Delete a user.
  391. tags:
  392. - nodes
  393. get:
  394. operationId: getUser
  395. schemes:
  396. - https
  397. summary: Get an individual user.
  398. tags:
  399. - nodes
  400. post:
  401. operationId: createUser
  402. schemes:
  403. - https
  404. summary: Create a user.
  405. tags:
  406. - nodes
  407. put:
  408. operationId: updateUser
  409. schemes:
  410. - https
  411. summary: Update a user.
  412. tags:
  413. - nodes
  414. /api/users/{username}/adm:
  415. put:
  416. description: Updates the given admin user's info (as long as the user is an admin)
  417. operationId: updateUserAdm
  418. schemes:
  419. - https
  420. tags:
  421. - nodes
  422. /api/users/adm/authenticate:
  423. post:
  424. operationId: authenticateUser
  425. schemes:
  426. - https
  427. summary: Node authenticates using its password and retrieves a JWT for authorization.
  428. tags:
  429. - nodes
  430. /api/users/adm/createadmin:
  431. post:
  432. operationId: createAdmin
  433. schemes:
  434. - https
  435. summary: Make a user an admin.
  436. tags:
  437. - nodes
  438. /api/users/adm/hasadmin:
  439. get:
  440. operationId: hasAdmin
  441. schemes:
  442. - https
  443. summary: Checks whether the server has an admin.
  444. tags:
  445. - nodes
  446. /api/users/networks/{username}:
  447. put:
  448. description: Updates the networks of the given user
  449. operationId: updateUserNetworks
  450. schemes:
  451. - https
  452. tags:
  453. - nodes
  454. /meshclient/files/{filename}:
  455. get:
  456. description: Retrieve a file from the file server
  457. operationId: fileServer
  458. schemes:
  459. - https
  460. tags:
  461. - meshclient
  462. produces:
  463. - application/json
  464. schemes:
  465. - https
  466. swagger: "2.0"