Skip to content
This repository has been archived by the owner on Nov 13, 2021. It is now read-only.

Unpredictable "select" query parameter behavior when fetching Product links via API #85

Closed
jpars opened this issue Jun 11, 2019 · 2 comments
Assignees

Comments

@jpars
Copy link

jpars commented Jun 11, 2019

When fetching entities linked to products via the API, the data returned for each linked entity seems to change unpredictably depending on what is passed in the "select" query parameter. I see this parameter is not included in the API docs (GET /Product/:entityId/:link), but is being used by GUI.

For example, the GUI is fetching product attributes by submitting a GET to /api/v1/Product/5cf9228ac7deb2492/productAttributeValues?primaryFilter=&select=attributeId%2CattributeName%2Cvalue%2CvalueEnUs%2CvalueDeDe%2Cscope%2CchannelsIds%2CchannelsNames%2Cdata&maxSize=200&offset=0&sortBy=id&asc=true

This returns a list of product attribute values similar to

{
   "total" : 1,
   "list" : [{
         "id": "5cffebdd09e05687e",
         "value": null,
         "data": null,
         "scope": "Global",
         "isCustom": false,
         "attributeType": "wysiwygMultiLang",
         "attributeId": "5cffea7d8eb8637aa",
         "attributeName": "Description",
         "productFamilyAttributeId": "5cffebdd0430bb06c",
         "channelsIds": [ ],
         "channelsNames": { },
         "createdById": "1",
         "assignedUserId": "1",
         "typeValue": null,
         "attributeGroupId": "5cffea780e88ad2da",
         "attributeGroupName": "Core",
         "sortOrder": 1
      }]
}

Removing the "select" query parameter changes the returned items to look similar to below. Note that the values of the "isCustom" and "attributeType" fields have changed.

{
   "total" : 1,
   "list" : [{
      "isCustom": true,
      "attributeType": null,
      "productFamilyAttributeId": "5cffebdd0430bb06c"
   }]
}

Adding the "select" parameter with any value (even an invalid field name), changes the returned data of each item again:

{
   "total" : 1,
   "list" : [{
      "id": "5cffebdd09e05687e",
      "isCustom": false,
      "attributeType": null,
      "productFamilyAttributeId": "5cffebdd0430bb06c",
      "createdById": "1",
      "assignedUserId": "1"
   }]
}

I'm not sure how to interpret this behavior. If it is behaving as expected, could details of the "select" query parameter be added to the API docs?

Thanks!

@r-zablodskiy r-zablodskiy self-assigned this Jun 12, 2019
@r-zablodskiy
Copy link
Contributor

Hello, @jpars. Thanks for you feedback. When you remove "select" query parameter for product attributes returned data must contain all attribute fields. But now displays only "isCustom", "attributeType" and "productFamilyAttributeId" fields. There is a bug, that will be fix in version 3.2.4. If you add any values to "select" parameter, returned data will contain only this fields and also unique identifiers of attribute, attribute creator and assigned user. Invalid field names will be ignored.

@jpars
Copy link
Author

jpars commented Jun 14, 2019

I just took the TreoPIM 3.6.0 update and this appears to be resolved. Thanks for the quick resolution!

@jpars jpars closed this as completed Jun 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants