Industrial
Industrial

Reputation: 42758

Storing data in Riak with automatic ID?

If I make a HTTP POST to riak, i.e http://localhost:8098/riak/mybucket along with JSON-encoded data {name: "John Doe"}, the object is saved as expected.

However, this data will be assigned to an id set by Riak automatically, something like WAqRNgxZl10FK0F3FLuorByNHgN.

Is it possible to make Riak return this id in the response of the HTTP POST?

Upvotes: 1

Views: 765

Answers (1)

Charles Hooper
Charles Hooper

Reputation: 2779

According to the Riak documentation, it returns the new key/ID in the Location header.

In the output, the Location header will give the you key for that object. To view the newly created object, go to “http://127.0.0.1:8091/Location” in your browser.

You can see the docs here - Scroll down to "Store a new object and assign random key "

Upvotes: 2

Related Questions