Fetching Public APIs
HTTP Fetch: GET
use seda_sdk_rs::{http_fetch, log, oracle_program, Process};
#[oracle_program]
impl MyDataRequest {
fn execute() {
let response = http_fetch("https://pokeapi.co/api/v2/pokemon-species/mewtwo", None);
if !response.is_ok() {
Process::error("Could not fetch API endpoint".as_bytes());
return;
}
let response_str = String::from_utf8(response.bytes).unwrap();
log!("Response: {}", response_str);
}
fn tally() {
panic!("Not implemented");
}
}Testing the Data Request
Parsing JSON Responses
HTTP Fetch: POST
Last updated
Was this helpful?

