How to Connect to Sync Gateway using RESTFul API in Java


#1

I have a requirement to connect Sync gateway using RESTFul Web services in Java.

Found some references in Couchbase documents & forum saying that they are using 59840 port for connecting to Sync gateway using Public REST API.

But, I couldn’t find any sample code. Can you guys help on this.

GET / HTTP/1.1 Host: localhost:59840


#2

Are you looking for something in particular? Which programming language? Is there something that isn’t clear from the documentation in particular?

I’m no expert on Sync Gateway, but it seems like, in general, you could just make a normal REST request using whatever REST tools/library you normally use.


#3

@Prasad_JavaGeek

I think the docs you are referring to were for the Mobile client REST API, this is similar to the Sync Gateway PUBLIC REST API but not the same.

The Sync Gateway REST API is documented here

You can directly access the REST API from a standalone Java application using a Java REST client library.
You can also leverage the support for offline operations and multi master sync via sync gateway by using one of the inplementations of Couchbase Lite for Java