Uploaded image for project: 'Repository'
  1. Repository
  2. REPO-166

Retrieve (List) Peer Associations

    Details

      Description

      Summary

      GET /nodes/{sourceNodeId}/targets [?where=(assocType="my:assocType")]

      GET /nodes/{targetNodeId}/sources [?where=(assocType="my:assocType")]

      Example Response

      {
        "list": {
          "pagination": {
            "count": 2,
            "hasMoreItems": false,
            "totalItems": 2,
            "skipCount": 0,
            "maxItems": 100
          },
          "entries": [
            {
              "entry": {
                "createdAt": "2016-05-04T15:14:25.465+0000",
                "isFolder": false,
                "isFile": true,
                "createdByUser": {
                  "id": "test",
                  "displayName": "Test User"
                },
                "modifiedAt": "2016-05-04T15:14:25.465+0000",
                "modifiedByUser": {
                  "id": "test",
                  "displayName": "Test User"
                },
                "name": "balloons.jpeg",
                "association": {
                  "assocType": "cm:references"
                },
                "id": "244c7cf2-ca68-484b-871e-10c479eed2fe",
                "nodeType": "cm:content",
                "content": {
                  "mimeType": "image/jpeg",
                  "mimeTypeName": "JPEG Image",
                  "sizeInBytes": 24857,
                  "encoding": "UTF-8"
                },
                "parentId": "e2a64d58-2581-4ed0-80b0-6e6d8798096c"
              }
            },
            {
              "entry": {
                "createdAt": "2016-05-04T15:14:25.465+0000",
                "isFolder": false,
                "isFile": true,
                "createdByUser": {
                  "id": "test",
                  "displayName": "Test User"
                },
                "modifiedAt": "2016-05-04T15:14:25.465+0000",
                "modifiedByUser": {
                  "id": "test",
                  "displayName": "Test User"
                },
                "name": "balloons.jpeg",
                "association": {
                  "assocType": "cm:parts"
                },
                "id": "244c7cf2-ca68-484b-871e-10c479eed2fe",
                "nodeType": "cm:content",
                "content": {
                  "mimeType": "image/jpeg",
                  "mimeTypeName": "JPEG Image",
                  "sizeInBytes": 24857,
                  "encoding": "UTF-8"
                },
                "parentId": "e2a64d58-2581-4ed0-80b0-6e6d8798096c"
              }
            }
          ]
        }
      }
      

      Acceptance Criteria

      basePath: /alfresco/api/-default-/public/alfresco/versions/1
      tags:
        - name: associations
          description: Node associations
      paths:
        '/nodes/{sourceId}/targets':
          get:
            tags:
              - associations
              - 5.2 changes
            summary: List node associations
            description: |
              Returns a list of target nodes that are pointed to (ie. are associated with) the current source node.
            operationId: listTargetAssociations
            produces:
              - application/json
            parameters:
              - name: sourceId
                in: path
                description: The identifier of a node.
                required: true
                type: string
              - name: assocType
                in: query
                description: Restrict the returned results to only those of the given association type
                type: string
                required: false 
              - name: include
                in: query
                description: Return additional info, eg. aspect, properties, path, isLink
                type: string
                required: false
              - $ref: '#/parameters/fieldsParam'
            responses:
              '200':
                description: Successful response
                schema:
                  $ref: '#/definitions/NodeAssocPaging'
              '400':
                description: Invalid parameter, eg. unknown assocType
              '404':
                description: If **sourceId** does not exist
              default:
                description: Error response
                schema:
                  $ref: '#/definitions/Error'
        '/nodes/{targetId}/sources':
          get:
            tags:
              - associations
              - 5.2 changes
            summary: List node associations
            description: |
              Returns a list of source nodes that point to (ie. are associated with) the current target node.
            operationId: listSourceNodeAssociations
            produces:
              - application/json
            parameters:
              - name: targetId
                in: path
                description: The identifier of a node.
                required: true
                type: string
              - name: assocType
                in: query
                description: Restrict the returned results to only those of the given association type
                type: string
                required: false 
              - name: include
                in: query
                description: Return additional info, eg. aspect, properties, path, isLink
                type: string
                required: false
              - $ref: '#/parameters/fieldsParam'
            responses:
              '200':
                description: Successful response
                schema:
                  $ref: '#/definitions/NodeAssocPaging'
              '400':
                description: Invalid parameter, eg. unknown assocType
              '404':
                description: If **targetId** does not exist
              default:
                description: Error response
                schema:
                  $ref: '#/definitions/Error'
        AssocInfo:
          type: object
          properties:
            assocType:
              type: string
        NodeAssocPaging:
          type: object
          properties:
            list:
              type: object
              properties:
                pagination:
                  $ref: '#/definitions/Pagination'
                entries:
                  type: array
                  items:
                    $ref: '#/definitions/NodeAssocMinimalEntry'  
        NodeAssocMinimalEntry:
          type: object
          required:
            - entry
          properties:
            entry:
              $ref: '#/definitions/NodeAssocMinimal'        
        NodeAssocMinimal:
          type: object
          properties:
            id:
              type: string
            parentId:
              type: string
            name:
              type: string
            nodeType:
              type: string
            isFolder:
              type: boolean
            isFile:
              type: boolean
            modifiedAt:
              type: string
              format: date-time
            modifiedByUser:
              $ref: '#/definitions/UserInfo'
            createdAt:
              type: string
              format: date-time
            createdByUser:
              $ref: '#/definitions/UserInfo'
            content:
              $ref: '#/definitions/ContentInfo'
            association:
              $ref: '#/definitions/AssocInfo'    
      

      Limitations

      • Only exact qname match is supported (when filtering by assoc type). The underlying NodeService also supports regexp qname match (either combined or split across namespace/localname) but this is not something we currently expose via the REST API (pending further requirements).
      • Paging is not currently supported, this is covered by RA-926
      • Sorting is not currently supported, this is covered by RA-927
      • The relativePath mechanism is not supported for peer associations, we'll consider it if the requirement arises
      • allowableOperations for adding/removing peer associations are not implemented, this will be done in a later value bundle (RA-1081)

      For live API spec, please see:

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                gcornwell Gavin Cornwell
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: