From 6777c6253088feabcba3e6deffc491e7089c1169 Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Wed, 3 May 2023 21:02:16 +0200 Subject: [PATCH] page titles --- generator/api.ts | 4 +-- generator/templates/ApiTemplate.ts | 12 +++++--- src/pages/accounts.mdx | 14 +++++---- src/pages/dns.mdx | 45 ++++++++++++++-------------- src/pages/docs/examples.mdx | 2 ++ src/pages/docs/faq.mdx | 2 ++ src/pages/docs/getting-started.mdx | 2 ++ src/pages/docs/how-netbird-works.mdx | 2 ++ src/pages/docs/how-to-guides.mdx | 2 ++ src/pages/docs/other.mdx | 2 ++ src/pages/docs/reference.mdx | 2 ++ src/pages/events.mdx | 11 +++---- src/pages/groups.mdx | 33 ++++++++++---------- src/pages/peers.mdx | 32 ++++++++++---------- src/pages/policies.mdx | 33 ++++++++++---------- src/pages/routes.mdx | 33 ++++++++++---------- src/pages/rules.mdx | 33 ++++++++++---------- src/pages/setup-keys.mdx | 24 ++++++++------- src/pages/tokens.mdx | 30 +++++++++---------- src/pages/users.mdx | 24 ++++++++------- 20 files changed, 186 insertions(+), 156 deletions(-) diff --git a/generator/api.ts b/generator/api.ts index 8e275b14..08c4a7a3 100644 --- a/generator/api.ts +++ b/generator/api.ts @@ -1,13 +1,12 @@ import template from './templates/ApiTemplate' import { slugify, toArrayWithKey, toTitle, writeToDisk } from './helpers' import { OpenAPIV3, OpenAPIV2 } from 'openapi-types' -import * as yaml from 'yaml'; import * as fs from 'fs' import * as ejs from 'ejs' export default async function gen(inputFileName: string, outputDir: string, apiUrl: string) { const specRaw = fs.readFileSync(inputFileName, 'utf8') - const spec = yaml.parse(specRaw) as any + const spec = JSON.parse(specRaw) as any // console.log('spec', spec) switch (spec.openapi || spec.swagger) { @@ -167,6 +166,7 @@ async function gen_v3(spec: OpenAPIV3.Document, dest: string, { apiUrl }: { apiU const content = ejs.render(template, { info: spec.info, + tag: key, sections, operations, schemas, diff --git a/generator/templates/ApiTemplate.ts b/generator/templates/ApiTemplate.ts index 8ce449d5..0be621cc 100644 --- a/generator/templates/ApiTemplate.ts +++ b/generator/templates/ApiTemplate.ts @@ -3,6 +3,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = '<%- tag %>' + <% operations.forEach(function(operation){ %> ## <%- operation.summary %> {{ tag: '<%- operation.operation.toUpperCase() %>' , label: '<%- operation.path %>' }} @@ -171,7 +173,7 @@ url = URI("<%- operation.fullPath %>") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::<% operation.operation.slice(0, 1).toUpperCase() + operation.operation.slice(1).toLowerCase() %>.new(url) +request = Net::HTTP::<%- operation.operation.slice(0,1).toUpperCase() + operation.operation.slice(1).toLowerCase()%>.new(url) <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>request["Content-Type"] = "application/json"<% }; %> <% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>request["Accept"] = "application/json"<% }; %> request["Authorization"] = "Token " @@ -185,11 +187,12 @@ puts response.read_body \`\`\`java OkHttpClient client = new OkHttpClient().newBuilder() .build(); +<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%> MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, '<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>'); +RequestBody body = RequestBody.create(mediaType, '<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>');<% }; %> Request request = new Request.Builder() .url("<%- operation.fullPath %>") - .method("<%- operation.operation.toUpperCase() %>", body) + .method("<%- operation.operation.toUpperCase() %>"<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>, body<% }; %>) <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>.addHeader("Content-Type", "application/json")<% }; %> <% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>.addHeader("Accept", "application/json")<% }; %> .addHeader("Authorization: Token ") @@ -211,7 +214,8 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => '<%- operation.operation.toUpperCase() %>', - CURLOPT_POSTFIELDS =>'<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>', + <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %> + CURLOPT_POSTFIELDS =>'<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>',<% }; %> CURLOPT_HTTPHEADER => array( <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>'Content-Type: application/json',<% }; %> <% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>'Accept: application/json',<% }; %> diff --git a/src/pages/accounts.mdx b/src/pages/accounts.mdx index b2077bd6..c52be6bc 100644 --- a/src/pages/accounts.mdx +++ b/src/pages/accounts.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'Accounts' + ## List all Accounts {{ tag: 'GET' , label: '/api/accounts' }} @@ -115,7 +117,7 @@ url = URI("https://api.netbird.io/api/accounts") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -127,11 +129,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/accounts") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -153,7 +154,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -347,7 +348,7 @@ url = URI("https://api.netbird.io/api/accounts/{accountId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -392,6 +393,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', + CURLOPT_POSTFIELDS =>'{ "peer_login_expiration_enabled": "boolean", "peer_login_expiration": "integer" diff --git a/src/pages/dns.mdx b/src/pages/dns.mdx index a292fe73..7a61e43c 100644 --- a/src/pages/dns.mdx +++ b/src/pages/dns.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'DNS' + ## List all Nameserver Groups {{ tag: 'GET' , label: '/api/dns/nameservers' }} @@ -115,7 +117,7 @@ url = URI("https://api.netbird.io/api/dns/nameservers") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -127,11 +129,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -153,7 +154,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -530,6 +531,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', + CURLOPT_POSTFIELDS =>'{ "name": "string", "description": "string", @@ -720,7 +722,7 @@ url = URI("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -732,11 +734,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -758,7 +759,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -1066,7 +1067,7 @@ url = URI("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -1141,6 +1142,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', + CURLOPT_POSTFIELDS =>'{ "name": "string", "description": "string", @@ -1331,7 +1333,7 @@ url = URI("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Delete.new(url) request["Authorization"] = "Token " @@ -1343,11 +1345,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") - .method("DELETE", body) + .method("DELETE") .addHeader("Authorization: Token ") @@ -1369,7 +1370,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'DELETE', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( @@ -1506,7 +1507,7 @@ url = URI("https://api.netbird.io/api/dns/settings") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -1518,11 +1519,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/settings") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -1544,7 +1544,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -1725,7 +1725,7 @@ url = URI("https://api.netbird.io/api/dns/settings") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -1772,6 +1772,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', + CURLOPT_POSTFIELDS =>'{ "disabled_management_groups": [ "string" diff --git a/src/pages/docs/examples.mdx b/src/pages/docs/examples.mdx index cc1bebd6..e1203bec 100644 --- a/src/pages/docs/examples.mdx +++ b/src/pages/docs/examples.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; +export const title = 'Examples' + ## NetBird Client on AWS ECS (Terraform)

diff --git a/src/pages/docs/faq.mdx b/src/pages/docs/faq.mdx index c9cd6396..9ddac97e 100644 --- a/src/pages/docs/faq.mdx +++ b/src/pages/docs/faq.mdx @@ -2,6 +2,8 @@ import {Note} from "@/components/mdx"; import {HeroPattern} from "@/components/H +export const title = 'FAQ' + ## What firewall ports should I open to use NetBird? ### Incoming ports diff --git a/src/pages/docs/getting-started.mdx b/src/pages/docs/getting-started.mdx index 03d1a2a8..f9779953 100644 --- a/src/pages/docs/getting-started.mdx +++ b/src/pages/docs/getting-started.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'Getting Started' + ## Quickstart Guide Step-by-step video guide on YouTube: diff --git a/src/pages/docs/how-netbird-works.mdx b/src/pages/docs/how-netbird-works.mdx index 31840cef..8152942a 100644 --- a/src/pages/docs/how-netbird-works.mdx +++ b/src/pages/docs/how-netbird-works.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'How NetBird Works' + ## Architecture ### Overview diff --git a/src/pages/docs/how-to-guides.mdx b/src/pages/docs/how-to-guides.mdx index 51837df1..28e6f7ff 100644 --- a/src/pages/docs/how-to-guides.mdx +++ b/src/pages/docs/how-to-guides.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Button, Note} from +export const title = 'How-to Guides' + ## Routing traffic to private networks

diff --git a/src/pages/docs/other.mdx b/src/pages/docs/other.mdx index b9b89a25..bb6f739a 100644 --- a/src/pages/docs/other.mdx +++ b/src/pages/docs/other.mdx @@ -2,6 +2,8 @@ import {Note} from "@/components/mdx"; import {HeroPattern} from "@/components/H +export const title = 'Other' + ## Google Summer of Code Ideas - 2022 This page lists the all project ideas for [Google Summer of Code 2022](https://summerofcode.withgoogle.com/). diff --git a/src/pages/docs/reference.mdx b/src/pages/docs/reference.mdx index 27627118..ed45fd33 100644 --- a/src/pages/docs/reference.mdx +++ b/src/pages/docs/reference.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; +export const title = 'Reference' + ## NetBird commands The NetBird client installation adds a binary called `netbird` to your system. This binary runs as a daemon service to connect diff --git a/src/pages/events.mdx b/src/pages/events.mdx index ffcab69d..f8481434 100644 --- a/src/pages/events.mdx +++ b/src/pages/events.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'Events' + ## List all Events {{ tag: 'GET' , label: '/api/events' }} @@ -115,7 +117,7 @@ url = URI("https://api.netbird.io/api/events") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -127,11 +129,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/events") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -153,7 +154,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', diff --git a/src/pages/groups.mdx b/src/pages/groups.mdx index 9c11c337..4e78d350 100644 --- a/src/pages/groups.mdx +++ b/src/pages/groups.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'Groups' + ## List all Groups {{ tag: 'GET' , label: '/api/groups' }} @@ -115,7 +117,7 @@ url = URI("https://api.netbird.io/api/groups") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -127,11 +129,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/groups") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -153,7 +154,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -400,6 +401,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', + CURLOPT_POSTFIELDS =>'{ "name": "string", "peers": [ @@ -568,7 +570,7 @@ url = URI("https://api.netbird.io/api/groups/{groupId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -580,11 +582,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/groups/{groupId}") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -606,7 +607,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -810,7 +811,7 @@ url = URI("https://api.netbird.io/api/groups/{groupId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -859,6 +860,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', + CURLOPT_POSTFIELDS =>'{ "name": "string", "peers": [ @@ -1027,7 +1029,7 @@ url = URI("https://api.netbird.io/api/groups/{groupId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Delete.new(url) request["Authorization"] = "Token " @@ -1039,11 +1041,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/groups/{groupId}") - .method("DELETE", body) + .method("DELETE") .addHeader("Authorization: Token ") @@ -1065,7 +1066,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'DELETE', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( diff --git a/src/pages/peers.mdx b/src/pages/peers.mdx index 4edc664a..65d8b9e0 100644 --- a/src/pages/peers.mdx +++ b/src/pages/peers.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'Peers' + ## List all Peers {{ tag: 'GET' , label: '/api/peers' }} @@ -115,7 +117,7 @@ url = URI("https://api.netbird.io/api/peers") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -127,11 +129,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/peers") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -153,7 +154,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -331,7 +332,7 @@ url = URI("https://api.netbird.io/api/peers/{peerId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -343,11 +344,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/peers/{peerId}") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -369,7 +369,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -589,7 +589,7 @@ url = URI("https://api.netbird.io/api/peers/{peerId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -636,6 +636,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', + CURLOPT_POSTFIELDS =>'{ "name": "string", "ssh_enabled": "boolean", @@ -816,7 +817,7 @@ url = URI("https://api.netbird.io/api/peers/{peerId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Delete.new(url) request["Authorization"] = "Token " @@ -828,11 +829,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/peers/{peerId}") - .method("DELETE", body) + .method("DELETE") .addHeader("Authorization: Token ") @@ -854,7 +854,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'DELETE', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( diff --git a/src/pages/policies.mdx b/src/pages/policies.mdx index e2329f0d..27f4db6e 100644 --- a/src/pages/policies.mdx +++ b/src/pages/policies.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'Policies' + ## List all Policies {{ tag: 'GET' , label: '/api/policies' }} @@ -115,7 +117,7 @@ url = URI("https://api.netbird.io/api/policies") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -127,11 +129,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/policies") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -153,7 +154,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -578,6 +579,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', + CURLOPT_POSTFIELDS =>'{ "name": "string", "description": "string", @@ -784,7 +786,7 @@ url = URI("https://api.netbird.io/api/policies/{policyId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -796,11 +798,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/policies/{policyId}") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -822,7 +823,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -1158,7 +1159,7 @@ url = URI("https://api.netbird.io/api/policies/{policyId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -1253,6 +1254,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', + CURLOPT_POSTFIELDS =>'{ "name": "string", "description": "string", @@ -1463,7 +1465,7 @@ url = URI("https://api.netbird.io/api/policies/{policyId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Delete.new(url) request["Authorization"] = "Token " @@ -1475,11 +1477,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/policies/{policyId}") - .method("DELETE", body) + .method("DELETE") .addHeader("Authorization: Token ") @@ -1501,7 +1502,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'DELETE', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( diff --git a/src/pages/routes.mdx b/src/pages/routes.mdx index 688de62a..78c1a351 100644 --- a/src/pages/routes.mdx +++ b/src/pages/routes.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'Routes' + ## List all Routes {{ tag: 'GET' , label: '/api/routes' }} @@ -115,7 +117,7 @@ url = URI("https://api.netbird.io/api/routes") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -127,11 +129,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/routes") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -153,7 +154,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -489,6 +490,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', + CURLOPT_POSTFIELDS =>'{ "description": "string", "network_id": "string", @@ -666,7 +668,7 @@ url = URI("https://api.netbird.io/api/routes/{routeId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -678,11 +680,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/routes/{routeId}") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -704,7 +705,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -985,7 +986,7 @@ url = URI("https://api.netbird.io/api/routes/{routeId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -1046,6 +1047,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', + CURLOPT_POSTFIELDS =>'{ "description": "string", "network_id": "string", @@ -1223,7 +1225,7 @@ url = URI("https://api.netbird.io/api/routes/{routeId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Delete.new(url) request["Authorization"] = "Token " @@ -1235,11 +1237,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/routes/{routeId}") - .method("DELETE", body) + .method("DELETE") .addHeader("Authorization: Token ") @@ -1261,7 +1262,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'DELETE', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( diff --git a/src/pages/rules.mdx b/src/pages/rules.mdx index 155b1665..b9105935 100644 --- a/src/pages/rules.mdx +++ b/src/pages/rules.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'Rules' + ## List all Rules {{ tag: 'GET' , label: '/api/rules' }} @@ -115,7 +117,7 @@ url = URI("https://api.netbird.io/api/rules") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -127,11 +129,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/rules") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -153,7 +154,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -474,6 +475,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', + CURLOPT_POSTFIELDS =>'{ "name": "string", "description": "string", @@ -654,7 +656,7 @@ url = URI("https://api.netbird.io/api/rules/{ruleId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -666,11 +668,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/rules/{ruleId}") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -692,7 +693,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -958,7 +959,7 @@ url = URI("https://api.netbird.io/api/rules/{ruleId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -1019,6 +1020,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', + CURLOPT_POSTFIELDS =>'{ "name": "string", "description": "string", @@ -1203,7 +1205,7 @@ url = URI("https://api.netbird.io/api/rules/{ruleId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Delete.new(url) request["Authorization"] = "Token " @@ -1215,11 +1217,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/rules/{ruleId}") - .method("DELETE", body) + .method("DELETE") .addHeader("Authorization: Token ") @@ -1241,7 +1242,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'DELETE', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( diff --git a/src/pages/setup-keys.mdx b/src/pages/setup-keys.mdx index 16738eef..687b970c 100644 --- a/src/pages/setup-keys.mdx +++ b/src/pages/setup-keys.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'Setup Keys' + ## List all Setup Keys {{ tag: 'GET' , label: '/api/setup-keys' }} @@ -115,7 +117,7 @@ url = URI("https://api.netbird.io/api/setup-keys") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -127,11 +129,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/setup-keys") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -153,7 +154,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -458,6 +459,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', + CURLOPT_POSTFIELDS =>'{ "name": "string", "type": "string", @@ -636,7 +638,7 @@ url = URI("https://api.netbird.io/api/setup-keys/{keyId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -648,11 +650,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/setup-keys/{keyId}") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -674,7 +675,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -928,7 +929,7 @@ url = URI("https://api.netbird.io/api/setup-keys/{keyId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -985,6 +986,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', + CURLOPT_POSTFIELDS =>'{ "name": "string", "type": "string", diff --git a/src/pages/tokens.mdx b/src/pages/tokens.mdx index af26e4ea..54081d11 100644 --- a/src/pages/tokens.mdx +++ b/src/pages/tokens.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'Tokens' + ## List all Tokens {{ tag: 'GET' , label: '/api/users/{userId}/tokens' }} @@ -123,7 +125,7 @@ url = URI("https://api.netbird.io/api/users/{userId}/tokens") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -135,11 +137,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/users/{userId}/tokens") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -161,7 +162,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -405,6 +406,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', + CURLOPT_POSTFIELDS =>'{ "name": "string", "expires_in": "integer" @@ -575,7 +577,7 @@ url = URI("https://api.netbird.io/api/users/{userId}/tokens/{tokenId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -587,11 +589,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/users/{userId}/tokens/{tokenId}") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -613,7 +614,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -777,7 +778,7 @@ url = URI("https://api.netbird.io/api/users/{userId}/tokens/{tokenId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Delete.new(url) request["Authorization"] = "Token " @@ -789,11 +790,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/users/{userId}/tokens/{tokenId}") - .method("DELETE", body) + .method("DELETE") .addHeader("Authorization: Token ") @@ -815,7 +815,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'DELETE', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( diff --git a/src/pages/users.mdx b/src/pages/users.mdx index 8d571e7c..432a6b31 100644 --- a/src/pages/users.mdx +++ b/src/pages/users.mdx @@ -2,6 +2,8 @@ import {HeroPattern} from "@/components/HeroPattern"; import {Note} from "@/comp +export const title = 'Users' + ## Retrieve Users {{ tag: 'GET' , label: '/api/users' }} @@ -123,7 +125,7 @@ url = URI("https://api.netbird.io/api/users") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Get.new(url) request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -135,11 +137,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/users") - .method("GET", body) + .method("GET") .addHeader("Accept", "application/json") .addHeader("Authorization: Token ") @@ -161,7 +162,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array( 'Accept: application/json', @@ -448,6 +449,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', + CURLOPT_POSTFIELDS =>'{ "email": "string", "name": "string", @@ -661,7 +663,7 @@ url = URI("https://api.netbird.io/api/users/{userId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Put.new(url) request["Content-Type"] = "application/json" request["Accept"] = "application/json" request["Authorization"] = "Token " @@ -710,6 +712,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', + CURLOPT_POSTFIELDS =>'{ "role": "string", "auto_groups": [ @@ -879,7 +882,7 @@ url = URI("https://api.netbird.io/api/users/{userId}") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true -request = Net::HTTP::Post.new(url) +request = Net::HTTP::Delete.new(url) request["Authorization"] = "Token " @@ -891,11 +894,10 @@ puts response.read_body ```java OkHttpClient client = new OkHttpClient().newBuilder() .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, ''); + Request request = new Request.Builder() .url("https://api.netbird.io/api/users/{userId}") - .method("DELETE", body) + .method("DELETE") .addHeader("Authorization: Token ") @@ -917,7 +919,7 @@ curl_setopt_array($curl, array( CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'DELETE', - CURLOPT_POSTFIELDS =>'', + CURLOPT_HTTPHEADER => array(