Skip to content
Advertisement

Tag: wikidata-api

How to Login to MediaWiki (Wikipedia) API in Node.js

I’m trying the Wikipedia client login flow depicted in the API:Login docs, but something wrong happens: 1) I correctly get a token raised with the HTTP GET https://en.wikipedia.org/w/api.php?action=query&meta=tokens&type=login&format=json and I get a valid logintoken string. 2.1) I then try the clientlogin like: HTTP POST /w/api.php?action=clientlogin&format=json&lgname=xxxx&lgtoken=xxxx%2B%5C and the POST BODY was But I get an error: If I try to change

Cannot access Wikidata API

I’m trying to use the Wikidata API, but all I’m getting is: Fetch API cannot load https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Ingmar%20Bergman&language=en&limit=20&format=json&origin=http%3A%2F%2Fwww.dev.example.com%3A3000. Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://www.dev.example.com:3000’ is therefore not allowed access. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with

Advertisement