nbaksalyar:
With the SAFE app client API, I’ve yet to see with an obvious option to call on URLs and public data
Yes, it’s indeed a temporary limitation. Currently, you can’t use XOR URLs outside of the SAFE Browser to fetch data from the network, but we certainly plan to add it to the Client Libs API.
As @nbaksalyar says, even that this is still not possible using the safe_client lib API yet, this is already possible as part of our experimental APIs in safe_app_nodejs and therefore also with the API exposed in the browser. Remember you need to have the experimental toggle on.
For a concrete example please look at the post we published when released SAFE Browser v0.11.0 :
Fetch data using publicName-URLs or XOR-URLs
Apart from the webFetch function which can be used to retrieve content compatible for an HTTP client, like the browser, it is now also possible to use the fetch function for retrieving a MutableData or ImmutableData from a URL, and be able to use the MD/IMMD API to manipulate it e.g. for mutating entries in a MutableData fetched with a URL. The following snippets shows how a MutableData can be fetched using its XOR-URL and apply a mutation to its entries:
Fetch MutableData with XOR-URL
const typeTag = 15015;
const md = await safeApp.mutableData.newRandomPublic(typeTag);
await md.quickSetup({ key1: 'value1', key2: 'value2' });
const info = await md.getNameAndTag();
const mdResource = await safeApp.fetch(info.xorUrl);
const mutation = await safeApp.mutableData.newMutation();
await mutation.insert('key3', 'value3');
await md.applyEntriesMutation(mutation);
4 Likes