Reputation: 580
I have a dynamo table storing an item with the primary and secondary keys as follows:
pk: Parent#{parent_id}
sk: Child#{child_id}.
This means when designing a GET endpoint to retreive the child, I need both the parent id and the child id, resulting into something like: /api/children/{parent_id}/{child_id}
.
For some reason, this doesn't feel right to me. Is this a bad practise?
Upvotes: 0
Views: 33
Reputation: 7122
It's not necessarily bad. For example, with Amazon S3 the bucket is the parent and the key is the child. And here's one way how S3 exposes access:
https://s3.Region.amazonaws.com/bucket-name/key-name
https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-bucket-intro.html
Upvotes: 1