Read-only relationships

If I have an entity called job and there are logs associated with that job, would those logs be considered a relationship resource object and would the relationship self link reference the relationship resource or the “related” resource? If we had a /jobs/123/relationships/logs resource, would it only support GET to retrieve a list of logs references?

Current Resources:

  • A job is fetched like GET /jobs/123
  • Job logs are fetch via GET /jobs/123/logs

Thanks!

Trying to pick apart some stuff with this.

The self link should refer to the link context in the document which resulted in the message. Meaning the self link will refer to the relationship link from the main resource, using the path example you included /jobs/123/relationships/logs.

The related link should point to the canonical URI for the resource, which should probably NOT be a sub resource of /jobs if you have any other resources which may also have a log. However, if it is truly a sub resource then the related link should be /jobs/123/logs/ as stated.

Nothing in the spec requires all resources to support all methods, so supporting whatever methods you want is no problem.

1 Like