restfb
RestFB is a simple and flexible Facebook Graph API client written in Java.
It is open source software released under the terms of the MIT License.

Features

restfb has been designed with several objectives in mind. The most important of these are defined as follows.

Zero runtime dependencies

You don't need to include additional libraries in your project. There are no dependency conflicts. In addition, RestFB is highly portable and can be used in both Android projects and normal Java applications.

Maximal extensibility

Although we provide a standard implementation for our core components, each component can be replaced with a custom implementation. This allows RestFB to be easily integrated into any kind of project. Even Android projects are supported.

Minimal public API

TThe RestFB API is really minimal and you only need to use one method to get information from Facebook and one to publish new items to Facebook. We provide default implementations for all the core components, so you can drop the jar into your project and be ready to go.

Simple metadata-driven configuration

Our Facebook types are simple POJOs with special annotations. This configuration is designed for ease of use and can be used to define custom types very easily.

Download

RestFB can be downloaded from Github or used as a Maven dependency. There is also a sample project on Github.

Download from Github

Newest Version of the library is available from RestFB's home on Github.
View the changelog here.

Download from Maven

RestFB is a single JAR - just drop it into your application and you're ready to go. Download it from Maven Central:
maven central restfb version

Restfb example

You can find a sample project on Github. This project can help you get up and running quickly.

Contribute

Working with source code

It's easy to work directly with the RestFB source code. This is necessary if you need to use an unreleased version or want to contribute to the code. It's very important to know that RestFB is using the Lombok code generator. All types use special annotations to generate the boilerplate code for the setters and getters. It's important to know that we made the design decision to handle Lists and Maps differently - the Lombok annotations are not used for them and we provide add(), remove() and getList() methods. The returned List is immutable to prevent inner Lists and Maps from being altered by other objects. This idea can be found at Martin Fowler's blog.

You need to install Lombok in your IDE to compile RestFB. If you don't, you will see a lot of compilation errors and missing methods. More information about installing Lombok for different IDEs can be found here.

Contributing to RestFB

Contributing code is an essential part of open source and we try to make this as easy as possible. All you need to do is fork RestFB on Github and send us a pull request. We have some requirements to merge the pull request into our Dev branch.

  • The code must be formatted with our code formatter (have a look at the misc folder)
  • The code should conform to our general design standards (if you feel it's necessary to go against the grain, please ask us first!)
  • Existing unit tests have to run without error (we use CI)
  • The pull request should be mergeable
  • Explain why you made the change and why it's beneficial
  • jUnit tests are a big plus
  • The pull request should be based on the dev branch
  • Group and squash your commits, fewer are better

These conditions are defined to make everyone's lives easier and cause fewer conflicts when merging a pull request into the dev branch. If you put some work in a pull request and it meets our requirements, it's very likely we'll merge it the same day.

If you don't want to dive into the RestFB code you can open an issue. We are very grateful for every issue you open, no matter what kind it is. We fix bugs, explain Facebook and answer your questions about RestFB and Facebook.

The restfb Team

Mark Allen picture

Mark Allen

Founder

Norbert Bartels picture

Norbert Bartels

Maintainer and Lead Developer

many contributors picture

many contributors

restfb source code is placed on Github and the library itself evolves with the help of many great people. A lot of Github users contribute to restfb. We get many hints and questions, and of course many pull and feature requests. And we'd like to say thank you to everyone who has helped along the way!

Sponsors

The development of restfb is sponsored by these great companies and individuals. If you also like to sponsor us, please check the sponsor button on our RestFB Github page or send us a short note here.

Licensing

restfb is open source software released under the terms of the MIT License:

Copyright (c) 2010-2024 Mark Allen, Norbert Bartels.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.