Oracle & HTTP Call
An oracle helps you to do external HTTP calls to an API.
- You can register an oracle with only one line of code:
// SYNTAX
oracle(name, permission, base_url).
// EXAMPLE
oracle(coindesk, r, 'api.coindesk.com/v1/bpi').
- The oracle
name
must be in snake_case OR camelCase - The second parameter should always be
r
(only READ permission is available ATM)
- Then, you must use the get_http() predicate whenever you want to get data from the oracle:
// SYNTAX
get_http(oracle_name, path, Output).
// EXAMPLE
prompt :-
get_http(coindesk, '/currentprice.json', Output),
set(coindesk, Output).
The Output name must be in PascalCase.
Last modified 1yr ago