Skip to content

What does creating a document with links look like? #105

@gabrielgrant

Description

@gabrielgrant

In "Updating" > "Creating a Document" the example document doesn't have any links.

When creating a document with links in the URL style, I'm assuming the top-level "links" template is still required, yes?

Example 1

POST /photos
Content-Type: application/json
Accept: application/json

{
  "links": {
    "photos.comments": "http://example.com/comments/{posts.comments}"
  },
  "photos": [{
    "title": "Ember Hamster",
    "src": "http://example.com/images/productivity.png",
    "links": {
      "comments": [ "1", "5", "12", "17" ]
    }
  }]
}

Or is it valid to just include the ID(s) and assume the server knows what type of object you're referencing?

Example 2

POST /photos
Content-Type: application/json
Accept: application/json

{
  "photos": [{
    "title": "Ember Hamster",
    "src": "http://example.com/images/productivity.png",
    "links": {
      "comments": [ "1", "5", "12", "17" ]
    }
  }]
}

I'm pretty sure the client should have to be explicit about what it is linking to, despite there not being any way to explicitly communicate whether a server supports ID-based JSON, URL-based JSON or both.

As with #101 it's possible that this is implicit, but I think at least having one of these examples in an appendix makes sense.

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