Integrate in your projects
Intro
You can use your backend from any front-end environment by simply sending HTTP requsets to your API. below We have few examples on how to do this...
Bash
curl -i https://koxy-cloud.deno.dev \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: CLOUDSPACE_TOKEN' \
--data '{"endpoint": "main"}'
Javascript
Using Koxy JS
import { koxyRun } from 'koxy-js';
const configs = {
cloudspace: "CLOUDSPACE_TOKEN",
endpoint: "main",
parameters: {} // send your own parameters
}
koxyRun(configs).then ( (response) => {
console.log(response);
})
Using fetch
const url = "https://koxy-cloud.deno.dev";
const options = {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "CLOUDSPACE_TOKEN"
},
body: JSON.stringify({
endpoint: "main",
parameters: {} // send your own parameters
})
};
fetch(url, options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Python
import requests
url = "https://koxy-cloud.deno.dev"
headers = {
"Content-Type": "application/json",
"Authorization": "q_15p0DxMKB81-CIUHSy426G8oPGtzjtT4vhuK9lsf4.R5A5gvcu3IrGvyGoyfrQhAs-Z-oQl4Y_XmlTIhUIkrc"
}
data = {
"endpoint": "main",
"parameters": {} # send your own parameters
}
response = requests.post(url, headers=headers, data=json.dumps(data))
if response.status_code == 200:
print(response.json())
else:
print(response.status_code)