0

In couchbase official documentation - http://www.couchbase.com/docs/couchbase-sdk-c-2.0/api-reference-view.html

There is an example of retrieving data from couchbase using views.

const char path[] = "myview?startkey=I,endkey=j";
libcouchbase_make_couch_request(instance, NULL, path, npath
                                NULL, 0, LIBCOUCHBASE_HTTP_METHOD_GET, 1);

I have downloaded and installed libcouchbase v 2.0.6

It seems there is no function libcouchbase_make_couch_request() or lcb_make_couch_request () available in the library.

Where am I wrong ?

Also it will help a lot if there is an example available somwhere for extracting data which is retrieved after we call the equivalent of libcouchbase_make_couch_request()

3
  • There is no libcouchbase tag in SO - Can anyone create it Commented Jun 14, 2013 at 7:39
  • The docs don't seem to match the source. There are a number of examples and the full source here: github.com/couchbase/libcouchbase/tree/master/example Commented Jun 14, 2013 at 10:52
  • I'm not sure there is enough traffic in the Couchbase tag to warrant creating a tag for just their C API. Commented Jun 14, 2013 at 10:54

1 Answer 1

1

The library itself comes with manpages, which are the most actual documentation. The index page is man 3 libcouchbase. The page you need is man 3 lcb_make_http_request. Also you can found docs in asciidoc format in the repo itself https://github.com/couchbase/libcouchbase/blob/master/man/man3couchbase/lcb_make_http_request.3couchbase.txt

Between 1.x and 2.x releases, we've changed API a lot, so that it isn't backward compatible mostly. And function libcouchbase_make_couch_request was only accessible in "developer preview" version (like beta), eventually it was named lcb_make_http_request, because you can use the same call to create design documents, and also perform admin tasks, like create/flush/delete bucket, etc.

Here is the code example from man page above:

lcb_http_request_t req;
lcb_http_cmd_t *cmd = calloc(1, sizeof(lcb_http_cmd_t));
cmd->version = 0;
cmd->v.v0.path = "_design/test/_view/all?limit=10";
cmd->v.v0.npath = strlen(item->v.v0.path);
cmd->v.v0.body = NULL;
cmd->v.v0.nbody = 0;
cmd->v.v0.method = LCB_HTTP_METHOD_GET;
cmd->v.v0.chunked = 1;
cmd->v.v0.content_type = "application/json";
lcb_error_t err = lcb_make_http_request(instance, NULL,
                                        LCB_HTTP_TYPE_VIEW,
                                        &cmd, &req);
if (err != LCB_SUCCESS) {
    ... failed to schedule request ...
Sign up to request clarification or add additional context in comments.

2 Comments

regarding your comment "The library itself comes with manpages, which are the most actual 'documentation. The index page is man 3 libcouchbase" - I installed libcouchbase in RHEL5.5. In this box the man pages didnt get installed , man 3 libcouchbase or man libcouchbase or apropos libcouchbase is not working. Do I have to do anything extra to get man pages installed along with the library ?
They should be installed with libcouchbase-devel package, if not, then it is a bug

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.