api2go
api2go copied to clipboard
Returning to One Relationships
I'm having trouble finding how to return a to one relationship. I forked the repo, and tried to add a to-one relationship here
I can't seem to figure out how to make this path /v0/users/1/credit_card return a single object instead of an array. I've tried using SetToOneReferenceID - but to no avail.
Hoping for some tips, or perhaps you could add an example like this?
$ curl localhost:8080/v0/users/1/credit_card | jq .
{
"data": [
{
"type": "credit_cards",
"id": "1",
"attributes": {
"ID": "1"
}
}
]
}