Documentation Index
Fetch the complete documentation index at: https://docs.riza.io/llms.txt
Use this file to discover all available pages before exploring further.
Your script can make outbound HTTP requests using popular HTTP packages for your given language.
Making outbound HTTP requests
Code you run with the execute code
endpoint can make outbound HTTP requests. By default all HTTP requests are
blocked. Configure allowed hosts and (optionally) associated credentials
with the http request parameter.
Allowed host patterns
Values of the host parameter within an allowed HTTP request configuration support two types of pattern matching.
* matches all hosts
*.example.com matches all subdomains of example.com, but not example.com itself
Adding authentication credentials
Rather than exposing HTTP authentication credentials to your code, you can pass
credentials to Riza directly and we’ll add them to outbound HTTP requests. This
ensures credentials can’t be stolen by malicious code.
HTTP Basic authentication
{
"http": {
"allow": [{
"host": "example.com",
"auth": {
"basic": {
"user_id": "johny.appleseed",
"password": "<password>",
},
}
}]
}
}
Bearer token authentication
{
"http": {
"allow": [{
"host": "example.com",
"auth": {
"bearer": {
"token": "<api token>",
},
}
}]
}
}
{
"http": {
"allow": [{
"host": "example.com",
"auth": {
"header": {
"name": "X-Example-Api-Key",
"token": "<api key>",
},
}
}]
}
}
Query parameter authentication
{
"http": {
"allow": [{
"host": "example.com"
"auth": {
"query": {
"key": "apikey",
"token": "<api key>",
},
}
}]
}
}
import Riza from '@riza-io/api';
const pythonCode = `
import requests
r = requests.get("https://api.ipify.org")
print(r.text)
`;
const riza = new Riza();
async function main() {
const resp = await riza.command.exec({
language: "python",
code: pythonCode,
http: {
allow: [{
host: "api.ipify.org",
}]
}
});
console.log(resp);
}
main();
{
"exit_code": 0,
"stdout": "192.108.121.165",
}