{"_id":"57fa6e422996241700c7c1e7","__v":0,"user":"5668fa9755e4b32100935d41","category":{"_id":"57fa65275ba65a17008b988f","__v":0,"version":"5668fab608f90021008e8832","project":"5668fab608f90021008e882f","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-10-09T15:41:27.321Z","from_sync":false,"order":7,"slug":"model-query-javascript","title":"Model query (Javascript)"},"parentDoc":null,"project":"5668fab608f90021008e882f","version":{"_id":"5668fab608f90021008e8832","__v":19,"project":"5668fab608f90021008e882f","createdAt":"2015-12-10T04:08:22.769Z","releaseDate":"2015-12-10T04:08:22.769Z","categories":["5668fab708f90021008e8833","569740f124490c3700170a64","569742b58560a60d00e2c25d","569742bd0b09a41900b2446c","569742cd69393517000c82b3","569742f459a6692d003fad8f","569743020b09a41900b2446d","5697430b69393517000c82b5","56a17776470ae00d00c30642","56a2c48a831e2a0d0069b1ad","56b535757bccae0d00e9a1cd","56e1ff6aa49fdc0e005746b5","57e1c88115bf6522002a5e4e","57fa65275ba65a17008b988f","57fbeea34002550e004c032e","58474584889b6c2d00fb86e9","58475dcc64157f0f002f1907","587e7b5158666c2700965d4e","58a349fc30852819007ba083"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.18.0","version":"1.18"},"githubsync":"","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-09T16:20:18.559Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"See the documentation on [Editing Fields/Hiding Item](doc:editing-fieldshiding-item) to make sure you are *sending* us the right metadata so that you can request it successfully.\n\nYou might want us to return additional information about the items for display in recommendations. For instance, you might want to display an author name, author image, or description field in your recommendation area.\n\nIn order to request extra fields, you need to send us the fields prior to fetching our recommendations with `setRequestFields` from our JavaScript SDK:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$p(\\\"setRequestFields\\\", [\\\"list\\\",\\\"of\\\",\\\"fields\\\",\\\"to\\\",\\\"return\\\"])\",\n      \"language\": \"javascript\",\n      \"name\": \"setRequestFields\"\n    }\n  ]\n}\n[/block]\nSometimes we might have items that don’t contain all the fields you request. If you want us to only return items that contain all the fields you request, you can set this, again, prior to calling fetch with `setRequestFieldAON` from the SDK.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$p(\\\"setRequestFieldsAON\\\", true)\",\n      \"language\": \"javascript\",\n      \"name\": \"setRequestFieldsAON\"\n    }\n  ]\n}\n[/block]\nIf you don’t see the fields you want, this is because the fields weren’t exposed on the page in a way we understand. To fix this, see our documentation on [Editing Fields/Hiding Item](doc:editing-fieldshiding-item).\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Corresponding options for API model endpoint\"\n}\n[/block]\nIf using our model query API endpoint, you can set the value of `requestFields` and `requestFieldsAON` as part of the JSON query body. You can see details in the [model query API endpoint documentation](doc:model).","excerpt":"","slug":"request-specific-fields-in-recommendations","type":"basic","title":"Request specific fields in recommendations"}

Request specific fields in recommendations


See the documentation on [Editing Fields/Hiding Item](doc:editing-fieldshiding-item) to make sure you are *sending* us the right metadata so that you can request it successfully. You might want us to return additional information about the items for display in recommendations. For instance, you might want to display an author name, author image, or description field in your recommendation area. In order to request extra fields, you need to send us the fields prior to fetching our recommendations with `setRequestFields` from our JavaScript SDK: [block:code] { "codes": [ { "code": "$p(\"setRequestFields\", [\"list\",\"of\",\"fields\",\"to\",\"return\"])", "language": "javascript", "name": "setRequestFields" } ] } [/block] Sometimes we might have items that don’t contain all the fields you request. If you want us to only return items that contain all the fields you request, you can set this, again, prior to calling fetch with `setRequestFieldAON` from the SDK. [block:code] { "codes": [ { "code": "$p(\"setRequestFieldsAON\", true)", "language": "javascript", "name": "setRequestFieldsAON" } ] } [/block] If you don’t see the fields you want, this is because the fields weren’t exposed on the page in a way we understand. To fix this, see our documentation on [Editing Fields/Hiding Item](doc:editing-fieldshiding-item). [block:api-header] { "type": "basic", "title": "Corresponding options for API model endpoint" } [/block] If using our model query API endpoint, you can set the value of `requestFields` and `requestFieldsAON` as part of the JSON query body. You can see details in the [model query API endpoint documentation](doc:model).