Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content let api don't return relationships #9411

Closed
freddyucv opened this issue Jul 22, 2016 · 11 comments

Comments

@freddyucv
Copy link
Contributor

commented Jul 22, 2016

When you do a request with "/api/content/query/" the relationships field aren't returned. You should be able to specify a depth up to 2 to pull the content graph.

We need to deprecate the ContentRelationshipsResource as the functionality will be subsumed by this.

@wezell

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2018

We need to allow a ?depth= param (max value = 2) that will return the nested content objects.

  • if you don't pass a depth, we return a list of [identifiers] of the related objects
  • if you pass depth=1 we return the related content objects.
  • if you pass depth=2 we return the related content objects for each of the content.
  • This needs to work for content queries and direct by id api calls.

@dsilvam dsilvam modified the milestones: 11272018_REX, Rex Current Nov 27, 2018

@dsilvam dsilvam modified the milestones: 12182018_REX, Rex Current Dec 26, 2018

@dsilvam dsilvam modified the milestones: 01082019_REX, Rex Current Jan 8, 2019

@nollymar nollymar self-assigned this Jan 10, 2019

@nollymar

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2019

@wezell

This comment has been minimized.

Copy link
Contributor

commented Jan 14, 2019

We need to use the field.variable as the property key.
If the remote end of the relationship is one, send the entry not an array
not the relation name
e.g. youtubes

also:

If the remote end of the relationship is one, send the entry not an array

nollymar added a commit that referenced this issue Jan 17, 2019

nollymar added a commit that referenced this issue Jan 17, 2019

@nollymar

This comment has been minimized.

Copy link
Contributor

commented Jan 17, 2019

Implemented here: #15852

@nollymar

This comment has been minimized.

Copy link
Contributor

commented Jan 17, 2019

Note to QA: this change was applied on this endpoint: http://localhost:8080/api/es/search as well

@nollymar nollymar added the Note to QA label Jan 17, 2019

@nollymar nollymar removed their assignment Jan 17, 2019

nollymar added a commit that referenced this issue Jan 17, 2019

dsilvam added a commit that referenced this issue Jan 18, 2019

Issue 9411 contentlet api does not return relationships (#15852)
* #9411 Including relationships with depth on json and xml response

* #9411 Adding IT

* #9411 Improving logging

* #9411 Applying Codacy suggestions

@erickgonzalez erickgonzalez self-assigned this Jan 23, 2019

@erickgonzalez

This comment has been minimized.

Copy link
Contributor

commented Jan 23, 2019

If depth is set to an invalid value should return 400.
E.g: depth = 5 or depth = xyz

@bryanboza bryanboza added this to FOX in QA Jan 24, 2019

@bryanboza

This comment has been minimized.

Copy link
Contributor

commented Jan 24, 2019

Ok, tested after the fix and we have some pending changes:

  • Both endpoints should be able to receive the depth parameter. Right now just the /api/content/query/ is able to do it.

  • The list of relationships should be separated only by (,), right now we are adding /
    SC: https://screencast.com/t/ga1aQje9l

  • Please add the Javadoc to every endpoint

@bryanboza bryanboza moved this from FOX to In Review in QA Jan 24, 2019

@nollymar nollymar self-assigned this Jan 25, 2019

nollymar added a commit that referenced this issue Jan 28, 2019

#9411 Fixes included here:
- New depth param for ESContentResourcePortlet
- Return a list of identifiers when depth=0
@wezell

This comment has been minimized.

Copy link
Contributor

commented Jan 29, 2019

  1. do not call add addRelationshipsToJSON if there is no depth specified
  2. maintain a list of relationships already followed and do not re-follow/rehydrate a relationship that has already been added, e.g. ?depth=2 Content Type A relates to Content Type B and then Content Type B includes Content Type A
  3. Use contentlet.getRelated("field") to make sure calls are cached and do not hit the DB continually
  4. ?depth= param only works for the new relationship fields and not legacy relationship. Customers that need to access the legacy relationships in the interim can use the deprecated ContentRelationshipResource

@dsilvam dsilvam modified the milestones: 01292019_REX, Rex Current Jan 29, 2019

nollymar added a commit that referenced this issue Feb 5, 2019

#9411 Changes on this PR:
- Relationships are cached to avoid hitting the DB continuously
- depth=3 is supported
- Only relationships fields are returned
- DoesAllowOnlyOne validation to return objects instead of lists
@nollymar

This comment has been minimized.

Copy link
Contributor

commented Feb 5, 2019

New changes implemented here: #15970

Note to QA:

  1. depth now supports 5 values:

    • 0 --> The contentlet object will contain the identifiers of the related contentlets
    • 1 --> The contentlet object will contain the related contentlets
    • 2 --> The contentlet object will contain the related contentlets, which in turn will contain the identifiers of their related contentlets
    • 3 --> The contentlet object will contain the related contentlets, which in turn will contain a list of their related contentlets
    • null --> Relationships will not be sent as part of the response
  2. http://localhost:8080/api/es/search now supports the depth param which must be sent as a query param this way http://localhost:8080/api/es/search?depth={depth_value}

  3. http://localhost:8080/api/content/ supports the depth as a path param, so that it must be sent as http://localhost:8080/api/content/depth/{depth_value}

  4. If the remote end of the relationship is one (for One-to-One and One-to-Many cardinalities), an object is returned which could be an identifier or a hydrated contentlet, according to the depth value. Otherwise, a list is returned.

  5. http://localhost:8080/api/es/search and http://localhost:8080/api/content/ will only return relationships that are defined as fields. If legacy relationships are needed, http://localhost:8080/v1/contentrelationships should be used instead.

@nollymar nollymar removed their assignment Feb 5, 2019

nollymar added a commit that referenced this issue Feb 6, 2019

nollymar added a commit that referenced this issue Feb 6, 2019

nollymar added a commit that referenced this issue Feb 6, 2019

dsilvam added a commit that referenced this issue Feb 6, 2019

More fixes for issue 9411 (#15970)
* #9411 Fixes included here:
- New depth param for ESContentResourcePortlet
- Return a list of identifiers when depth=0

* #9411 Changes on this PR:
- Relationships are cached to avoid hitting the DB continuously
- depth=3 is supported
- Only relationships fields are returned
- DoesAllowOnlyOne validation to return objects instead of lists

* #9411 Applying Codacy suggestions

* #9411 Updating javadoc

* #9411 Updating javadoc
@bryanboza

This comment has been minimized.

Copy link
Contributor

commented Feb 11, 2019

New card reported here #16008... We can close this one

@bryanboza bryanboza moved this from In Review to Done in QA Feb 11, 2019

@wezell wezell closed this Feb 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.