api2go icon indicating copy to clipboard operation
api2go copied to clipboard

Returning to One Relationships

Open stobias123 opened this issue 3 years ago • 0 comments

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"
      }
    }
  ]
}

stobias123 avatar May 20 '22 04:05 stobias123