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

REST API lang parameter does not work in combination with fields parameter #1063

Open
gryphonmyers opened this issue Mar 21, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@gryphonmyers
Copy link

commented Mar 21, 2019

Repro Steps (positive projection):

  1. query a collection with localized data, e.g. api/collections/get/myCollection?token=XX&lang=de
  2. Note that localized versions of fields are sent
  3. Now query the same collection specifying a positive fields projection for a field which has a value for the localized version of the field, e.g. api/collections/get/myCollection?token=XX&lang=de&fields[myField]=1
  4. Note that the localized versions of the projected fields are not sent.

Repro steps (negative projection):

  1. query a collection with localized data, e.g. api/collections/get/myCollection?token=XX&lang=de
  2. Note that localized versions of fields are sent
  3. Now query the same collection specifying a negative fields projection for a field which has a value for the localized version of the field, e.g. api/collections/get/myCollection?token=XX&lang=de&fields[myField]=0
  4. Note that even though the field should be excluded from the result, it is still sent (in localized form).
  5. Now query the same collection specifying a negative fields projection for the localized version of the same field, e.g. api/collections/get/myCollection?token=XX&lang=de&fields[myField_de]=0
  6. Note that instead of removing the field from the response, the unlocalized version of the field is sent.

Expected behavior:

When sending the fields parameter in combination with the lang parameter, it should send the localized versions of any fields matched by a positive projection, and remove any fields matching a negative projection for the field or the localized version of the field

@raffaelj

This comment has been minimized.

Copy link
Contributor

commented Apr 5, 2019

I had the same issue right now and I found a workaround. Just add the localized field name to the projection.

api/collections/get/myCollection?token=XX&lang=de&fields[myField]=1&fields[myField_de]=1
api/collections/get/myCollection?token=XX&lang=de&fields[myField]=0&fields[myField_de]=0

It's not perfect if you have a lot of fields. I just needed the titles of a collection for a navigation and adding one parameter for this quest sounds OK for me.

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.