openapi: 3.0.3
info:
title: Spring Data REST Association API
description: Spring Data REST exposes Spring Data repositories as hypermedia-driven RESTful resources following the HATEOAS constraint. It provides automatic endpoint generation for CRUD operations, pagination, sorting, projections, and custom query endpoints derived from repository methods.
version: 4.3.0
contact:
name: Spring Team
url: https://spring.io/projects/spring-data-rest
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: http://localhost:8080
description: Default local server
tags:
- name: Association
paths:
/{repository}/{id}/{association}:
get:
operationId: getAssociation
summary: Get Resource Association
description: Returns the associated resource(s) for a given relationship
tags:
- Association
parameters:
- name: repository
in: path
required: true
schema:
type: string
- name: id
in: path
required: true
schema:
type: string
- name: association
in: path
required: true
schema:
type: string
description: Association name (e.g., address, orders)
responses:
'200':
description: Associated resource(s)
content:
application/hal+json:
schema:
oneOf:
- $ref: '#/components/schemas/Resource'
- $ref: '#/components/schemas/PagedResource'
'404':
description: Resource or association not found
put:
operationId: setAssociation
summary: Set Resource Association
description: Replaces the association links for a resource
tags:
- Association
parameters:
- name: repository
in: path
required: true
schema:
type: string
- name: id
in: path
required: true
schema:
type: string
- name: association
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
text/uri-list:
schema:
type: string
description: Newline-separated list of resource URIs
responses:
'204':
description: Association updated
'404':
description: Resource not found
delete:
operationId: deleteAssociation
summary: Delete Resource Association
description: Removes all association links for a resource
tags:
- Association
parameters:
- name: repository
in: path
required: true
schema:
type: string
- name: id
in: path
required: true
schema:
type: string
- name: association
in: path
required: true
schema:
type: string
responses:
'204':
description: Association deleted
'404':
description: Resource not found
components:
schemas:
Resource:
type: object
properties:
_links:
$ref: '#/components/schemas/Links'
additionalProperties: true
PagedResource:
type: object
properties:
_embedded:
type: object
additionalProperties:
type: array
items:
$ref: '#/components/schemas/Resource'
_links:
$ref: '#/components/schemas/Links'
page:
$ref: '#/components/schemas/PageMetadata'
PageMetadata:
type: object
properties:
size:
type: integer
description: Number of items per page
totalElements:
type: integer
description: Total number of items
totalPages:
type: integer
description: Total number of pages
number:
type: integer
description: Current page number (zero-based)
Links:
type: object
additionalProperties:
$ref: '#/components/schemas/Link'
Link:
type: object
properties:
href:
type: string
description: The URI of the link
templated:
type: boolean
description: Whether the href is a URI template