We are experiencing some weird behavior on Bucket REST API after upgrading Couchbase 4.6.3 to 5.0. Documents created using Bucket API REST are stored empty.
We use some .bat and .sh scripts in order to populate our buckets right before we start doing stress testing and user driven tests. Each bucket on our Couchbase DB has its user account with specific access role. Still, we use the Administrator user to call Bucket REST API.
The next command is an example of one of many curl commands we fire from .bat and .sh scripts. This particularly example belongs to a Windows .bat script:
curl -i -k -u Administrator: -H “Content-Type: application/json” -X POST http://<cb_ip>:8091/pools/default/buckets/places/docs/ct:ZZ:en -d @city_unknown_en.json
“locality”: “Unknown City/Locality”,
“adminareal2”: “Unknown Neighbourhood”,
“adminareal1”: “Unknown State/Province”,
- Trying <cb_ip>…
- TCP_NODELAY set
- Connected to <cb_ip> (<cb_ip>) port 8091 (#0)
- Server auth using Basic with user ‘Administrator’
POST /pools/default/buckets/places/docs/ct:ZZ:en HTTP/1.1
- upload completely sent off: 165 out of 165 bytes
HTTP/1.1 200 OK
X-XSS-Protection: 1; mode=block
Server: Couchbase Server
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Date: Sun, 05 Nov 2017 17:37:56 GMT
Despite of the 200 OK message, when we try to query that document it returns empty:
select ct.* from places ct use keys [‘ct:ZZ:en’]
And from Couchbase Web Console we see a strange warning message: “Editing of binary document is not allowed”.
And when querying directly using REST GET method:
We suspect from the previous response that the Bucket API REST for creation/update of documents is receiving a json payload as binary and trying to store it as json (that’s why the invalid_json).
- Which is the new JSON format to POST a new document?
- Are we missing a command flag?
- Do you have an example of how to do it right?
We are already in production so we need to figure the solution out as soon as possible. Thanks in advance!