0

I ran

 curl -v -X PUT http://localhost:10018/riak/animals/polly?returnbody=ture -H "Content-Type: application/json" -d '{"nickname" : "Sweet Polly Purebred", "breed" : "Purebred"}'

When I fetch /riak/animals/polly I get the expected:

 - {
"nickname": "Sweet Polly Purebred",
"breed": "Purebred"
}

I have /riak/photos/polly.png.

I want to link polly to point to the photos. I tried:

curl -X PUT http://localhost:10018/riak/animals/polly -H "Content-Type: application/json" -H "Link </riak/photos/polly.png; riaktag=\"contains\""

and now when I fetch/riak/animals/polly, an empty page appears.

How do I link /riak/animals/polly to /riak/photos/polly.png?

quantumpotato
  • 9,637
  • 14
  • 70
  • 146

1 Answers1

1

Your second command should have been:

curl -X PUT http://localhost:10018/riak/animals/polly -H 'Content-Type: application/json' -H 'Link: </riak/photos/polly.png>; riaktag="contains"'

Note the colon (Link:) and other angle bracket (>). In addition, I would suggest using single quotes when your strings don't need shell interpolation - that makes building the Link: header simpler.

Documentation: http://docs.basho.com/riak/latest/theory/concepts/Links/

Luke Bakken
  • 8,993
  • 2
  • 20
  • 33
  • Hm, same issue with the command you posted. When I run: curl -v -X PUT http://localhost:10018/riak/animals/polly?returnbody=ture -H "Content-Type: application/json" -d '{"nickname" : "Sweet Polly Purebred", "breed" : "Purebred"}' I get a response from in terminal, not so on the PUT – quantumpotato Jan 14 '14 at 01:33