fixing api docs issues

This commit is contained in:
Martina 2021-05-26 13:05:13 -07:00
parent dcaa8f0cc3
commit 81b08a85a8
5 changed files with 38 additions and 8 deletions

View File

@ -19,6 +19,12 @@ const EXAMPLE_CODE_JS = (
if (!response) {
console.log("No response");
return;
}
if (!response.ok) {
console.log(response.error);
return response.error;
}
const json = await response.json();

View File

@ -4,7 +4,7 @@ import * as System from "~/components/system";
import CodeBlock from "~/components/system/CodeBlock";
const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.host/api/v1/get', {
method: 'POST',
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic ${key}',
@ -16,6 +16,12 @@ const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.ho
if (!response) {
console.log("No response");
return;
}
if (!response.ok) {
console.log(response.error);
return response.error;
}
const json = await response.json();
@ -41,7 +47,7 @@ json = {
}
}
r = requests.post(url, headers=headers, json=json)
r = requests.get(url, headers=headers, json=json)
print(JSON.dumps(r.json(), indent=2))`;

View File

@ -19,6 +19,12 @@ const EXAMPLE_CODE_JS = (
if (!response) {
console.log("No response");
return;
}
if (!response.ok) {
console.log(response.error);
return response.error;
}
const json = await response.json();

View File

@ -19,6 +19,12 @@ const EXAMPLE_CODE_JS = (
if (!response) {
console.log("No response");
return;
}
if (!response.ok) {
console.log(response.error);
return response.error;
}
const json = await response.json();

View File

@ -4,7 +4,7 @@ import * as System from "~/components/system";
import CodeBlock from "~/components/system/CodeBlock";
const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.host/api/v2/get', {
method: 'POST',
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic ${key}',
@ -13,6 +13,12 @@ const EXAMPLE_CODE_JS = (key) => `const response = await fetch('https://slate.ho
if (!response) {
console.log("No response");
return;
}
if (!response.ok) {
console.log(response.error);
return response.error;
}
const json = await response.json();
@ -32,7 +38,7 @@ headers = {
"Authorization": "Basic ${key}",
}
r = requests.post(url, headers=headers)
r = requests.get(url, headers=headers)
print(JSON.dumps(r.json(), indent=2))`;