Skip to content

Allow adding links to Relationship Object #166

@LeeJump24

Description

@LeeJump24

Is it possible to add a link to a relationship? So add a link to the firstQuestion

"relationships": {
  "questions": {
    "links": {
      "firstQuestion": "http://localhost/api/v1/questions/616c98f8-3ea9-4bb2-8152-3dd40c3846eb",
      "related": "http://localhost/api/v1/surveys/4b732db9-48da-43c9-bec0-6df2dc7dcbe3/questions",
      "self": "http://localhost/api/v1/surveys/4b732db9-48da-43c9-bec0-6df2dc7dcbe3/relationships/questions"
    }
  }
}

I'm not an expert on the spec but reading https://jsonapi.org/format/#document-resource-object-relationships sounds like it should be allowed? We can add extra links to other link objects.

Full example

{
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "http://localhost/api/v1/surveys/4b732db9-48da-43c9-bec0-6df2dc7dcbe3"
  },
  "data": {
    "type": "surveys",
    "id": "4b732db9-48da-43c9-bec0-6df2dc7dcbe3",
    "attributes": {
      "name": "Survey A",
      "description": "Description of Survey A"
    },
    "relationships": {
      "questions": {
        "links": {
          "firstQuestion": "http://localhost/api/v1/questions/616c98f8-3ea9-4bb2-8152-3dd40c3846eb",
          "related": "http://localhost/api/v1/surveys/4b732db9-48da-43c9-bec0-6df2dc7dcbe3/questions",
          "self": "http://localhost/api/v1/surveys/4b732db9-48da-43c9-bec0-6df2dc7dcbe3/relationships/questions"
        }
      }
    },
    "links": {
      "self": "http://localhost/api/v1/surveys/4b732db9-48da-43c9-bec0-6df2dc7dcbe3"
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy