Binary Document, base64 not available

In Postman, I used the REST API to publish this document
{
“id”: “Crumb”,
“cas”: 0,
“token”: null,
“content”: “{“Name”:“Flour Cookie”,“Gender”:“Food”,“Age”:100}”
}
and got Status 200. Problem is, on document editor the entry has this message “Binary Document, base64 not available”.

What am I doing wrong? SOS!

Couchbase Server doesn’t have an official REST API for posting documents. The one the Web Console uses is, I believe, a private interface. Do you mean you added this through Sync Gateway, or did you use the private interface?

Generally we intend that you add docs through the SDKs or other tools. For example the cbc command line included with libcouchbase (which you can yum/apt/brew install) has cbc cp and other tools for adding JSON docs. Those handle the metadata and so on.

1 Like

In addition to what mentioned above me, while Couchbase doesn’t expose direct interface for posting documents into Couchbase except of the SDK, you can also use N1QL insert statement to insert docs.
https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/insert.html
and
https://docs.couchbase.com/server/6.5/n1ql/n1ql-rest-api/index.html

1 Like

Much thanks @roikatz and @ingenthr :sunglasses:

I managed to get it working by doing the following:

Method: POST
Endpoint: node:port/_p/query/query/service
Content-Type: text/plain
Body:
INSERT INTO People (KEY, VALUE)
VALUES
(
“{{$guid}}”,
{
“Name”:“Arnold”,
“Gender”:“Schwarzenegger”,
“Age”:72
}
)