The Wikia API V1 lost its documentation following the UCP update. Some of the endpoints disappeared without notice throughout the years and, generally, it seems that Wikia API is no longer supported.
A library for Fandom APIv1 (formerly known as Wikia) interaction, which makes it easy to access data from specified fandom URL
One only need to provide a Fandom URL and a callback method which will take a complete Fandom API URL, and return a json response. With this approach the library is fully http client agnostic, so you may use any http client library you like for requests.
Using http library:
import 'dart:convert';
import 'package:fandom/src/fandom.dart';
import 'package:http/http.dart' as http;
Future<void> main() async {
var fandom = Fandom('https://marvel.fandom.com',
(path) => http.get(path).then((value) => json.decode(value.body)));
var result = await fandom.search.list('Wolverine');
print('result: ${result.items.first.snippet}');
}
Using Dio library:
import 'package:dio/dio.dart';
import 'package:fandom/src/fandom.dart';
Future<void> main() async {
var fandom = Fandom('https://marvel.fandom.com',
(path) => Dio().get(path).then((value) => value.data));
var result = await fandom.search.list('Wolverine');
print('result: ${result.items.first.snippet}');
}
One should be able to read the Fandom APIv1 documentation, to get the general gist on how to use the library.
The API documentation is not exactly up to date with what is actually returned in a response. So the library may use other types for instance members than what is stated in API documentation, and some members are missing and some new ones are not in the API documentation. I´ve done my best to weed out most of the pecularities...
Some model names differ between API documentation and library, due to desire of having the model naming convention consistent in the library.
Merged into resource 'Search'
WikiaItem -> WikiaInfo
Wikia -> NavigationLink\
UserElement -> User
UserQueryResultItem -> UserQuery\
LocalWikiSearchResult -> LocalWikiSearch\
Please file feature requests and bugs at the issue tracker.