This is a Java client for Archive-It's API. It enables you to query seeds, collections, WARC file metadata and account settings. You can either use it with your own Archive-It credentials to gain access to your data, or without credentials to query public data.
This is a Maven project, so you simply use it as a dependency in your project.
The main starting point is the ArchiveitClient class:
ArchiveitClient client = new ArchiveitClient("myUsername", "myPassword");Note that you do not need to provide credentials if you are only getting publicly available information from the API. In this case, just instantiate the client without a username and password:
ArchiveitClient client = new ArchiveitClient();The API functionalities of the client are divided into ''services''. Each service is responsible for a specific part of the API:
CollectionServiceSeedServiceAuthenticationServiceAccountServiceWarcService
Here is an example of getting the collection with ID 123 using the CollectionService:
ArchiveitClient client = new ArchiveitClient("myUsername", "myPassword");
Collection collection = client.getCollectionService().getCollectionById(123);
System.out.println(collection.toString());Here we will give a few illustrative examples and use cases.
Assuming you know the ID if your collection, you can run:
ArchiveitClient client = new ArchiveitClient("myUsername", "myPassword");
List<Seed> seeds = client.getSeedService().getSeedsByCollectionId(collectionId);
for (Seed seed : seeds)
{
System.out.println(seed.toString());
}
System.out.println("Total: " + seeds.size()); Assuming you know the ID of your seed, you can run:
ArchiveitClient client = new ArchiveitClient("myUsername", "myPassword");
Seed seed = client.getSeedService().getSeedById(seedId);
System.out.println(seed.toString());Assuming you now the ID of your account, you can run:
ArchiveitClient client = new ArchiveitClient("myUsername", "myPassword");
List<Collection> collections = client.getCollectionService().getCollectionsByAccountId(accountId);
for (Collection collection : collections)
{
System.out.println(collection.toString());
}
System.out.println("Total: " + collections.size());You can find executable code examples under src/test/java, in the AppTest class.
See COPYING to see full text.