wikibase-sdk
wikibase-sdk copied to clipboard
Network request failed error
I am using wikibase-sdk package in React Native , I always get this error
Network request failed
const wbk = WBK({
instance: 'https://my-wikibase-instan.se',
sparqlEndpoint: 'https://query.wikidata.org/sparql',
});
useEffect(()={
const url = wbk.getEntities({
ids: ['Q25387195'],
languages: ['ar'],
});
console.log('====================================');
console.log(url);
console.log('====================================');
// const url = wbk.getEntities({
// ids: ['Q1', 'Q5', 'Q571'],
// languages: ['en', 'fr', 'de'], // returns all languages if not specified
// props: ['info', 'claims'], // returns all props if not specified
// format: 'xml', // default: json
// });
},[])
you probably want to set the instance argument to the actual instance? or did you change it here to some dummy value?
When interested in wikidata you need to import wdk:
import wdk from 'wikibase-sdk/wikidata.org'
Hi @EdJoPaTo I did not get you I used it as it is above, I don't exactly know what are the requirements of using this package. should I generate my custom instance?
and when I used import wdk from 'wikibase-sdk/wikidata.org'
I got Unable to resolve module Error
The idea of wikibase-sdk is to connect to an existing Wikibase instance. For example Wikidata is one Wikibase instance. (You can of course host your own Wikibase instance but thats probably not what you want to do.)
You configure which instance you want to connect with or just use the preconfigured wdk
one which I mentioned in my last message which is already defined for Wikidata.
Also notice that this library does nothing with the network by itself. Network errors would be from some other source. Also the not working import is probably related to your setup? are you sure you are using wikibase-sdk
v9? Earlier versions did not hat the wikidata.org export available so that might be a reason why thats not working
yes I am using 9.1.2 v do you think this is because I am using typescript?