diff options
-rw-r--r-- | support/doc/api/openapi.yaml | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index a13627a78..032d798fc 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml | |||
@@ -160,35 +160,25 @@ paths: | |||
160 | http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos | 160 | http -b GET https://peertube2.cpy.re/api/v1/accounts/{name}/videos |
161 | - lang: Ruby | 161 | - lang: Ruby |
162 | source: | | 162 | source: | |
163 | require 'uri' | ||
164 | require 'net/http' | 163 | require 'net/http' |
164 | require 'json' | ||
165 | 165 | ||
166 | url = URI("https://peertube2.cpy.re/api/v1/accounts/{name}/videos") | 166 | uri = URI.parse("https://peertube2.cpy.re/api/v1/accounts/{name}/videos") |
167 | 167 | ||
168 | http = Net::HTTP.new(url.host, url.port) | 168 | http = Net::HTTP.new(uri.host, uri.port) |
169 | http.use_ssl = true | 169 | http.use_ssl = true |
170 | http.verify_mode = OpenSSL::SSL::VERIFY_NONE | ||
171 | 170 | ||
172 | request = Net::HTTP::Post.new(url) | 171 | response = http.get(uri.request_uri) |
173 | request["content-type"] = 'application/json' | 172 | |
174 | response = http.request(request) | 173 | puts JSON.parse(response.read_body) |
175 | puts response.read_body | ||
176 | - lang: Python | 174 | - lang: Python |
177 | source: | | 175 | source: | |
178 | import http.client | 176 | import requests |
179 | |||
180 | conn = http.client.HTTPSConnection("https://peertube2.cpy.re/api/v1") | ||
181 | |||
182 | headers = { | ||
183 | 'content-type': "application/json" | ||
184 | } | ||
185 | |||
186 | conn.request("POST", "/accounts/{name}/videos", None, headers) | ||
187 | 177 | ||
188 | res = conn.getresponse() | 178 | r = requests.get("https://peertube2.cpy.re/api/v1//accounts/{name}/videos") |
189 | data = res.read() | 179 | json = r.json() |
190 | 180 | ||
191 | print(data.decode("utf-8")) | 181 | print(json) |
192 | /accounts: | 182 | /accounts: |
193 | get: | 183 | get: |
194 | tags: | 184 | tags: |