Skip to content

leonardiwagner/jsonbox-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsonbox-java Travis (.org) Coveralls github Maven Central

JVM library for jsonbox.io: A HTTP based JSON storage. It lets you store, read & modify JSON data over HTTP APIs for FREE. Ideal for small projects, prototypes or hackathons, where you don't have to spin up your own data store.

Demo example:

JsonBoxStorage storage = new JsonBoxStorage("box30c83d77bab82ce487665");
// create a new record
storage.create(adapter.toJson(new Record("john")));
// read records
List<Record> records = adapter.fromJson(storage.read());

Starting Guide

  1. Installation
  2. Basic examples
  3. Advanced examples with JSON parsing

Documentation

Constructors

Name Summary
JsonBoxStorage() Instance for a jsonbox.io box, a random box id will be generated, you can use getBoxId() to retrieve the generated box id
JsonBoxStorage(String boxId) Instance for a jsonbox.io box
JsonBoxStorage(String boxId, String collectionId) Instance for a jsonbox.io collection inside a box

Functions

Name Summary
create(String json) Create a new record
read() Read all records
read(int skip, int limit, String filter, String sort) Read records with pagination, filtering and sorting*
update(String recordId, String json) Update a record by a given record id
delete(String recordId) Delete a single record by a given record id
deleteFiltering(String filter) Delete multiple records using filtering*

*filtering and sorting:

  • filter usage here
  • sort by a json property, use - for descending sorting, example: "-name".

Getters

Name Summary
getBoxId() current box id
getCollectionId() current collection id (returns null if you are not using a collection)

Helper Functions for reading

Name Summary
readFiltering(String filter) Read applying only filtering
readSorting(String sort) Read applying only sorting
read(int skip, int limit) Read applying only pagination**
read(int skip, int limit, String filter) Read applying only pagination and filtering**

**default sorting is _createdOn desc.

Contribution

Feel free to contribute. Just create an issue before sending a Pull Request.

License

Apache 2.0