{"_id":"569752898560a60d00e2c26b","editedParams":true,"__v":21,"parentDoc":null,"user":"56839cf74aecbd0d00a4659e","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"},"project":"5668fab608f90021008e882f","category":{"_id":"569742f459a6692d003fad8f","pages":["56974f48d231880d00676e6a","56975101d231880d00676e6c","5697511369393517000c82c8","5697512159a6692d003fada0","569752668560a60d00e2c268","569752898560a60d00e2c26b","569752add231880d00676e70","569752bd8400d52d00dd56ab","569752c769393517000c82cc","56e9cf33fae86b0e00e5394f","56e9cfe2af392b170035f68f"],"project":"5668fab608f90021008e882f","version":"5668fab608f90021008e8832","__v":11,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-01-14T06:40:52.350Z","from_sync":false,"order":1,"slug":"api-integration-rest-api","title":"REST API (For App/Backend)"},"editedParams2":true,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-14T07:47:21.077Z","link_external":false,"link_url":"https://documenter.getpostman.com/view/2166502/liftigniter/7TFGvSV#9bdf75da-edd6-45ec-9c28-a0edefad1389","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"curl -H \"Content-Type: application/json\" -d '{\n  \"apiKey\" : \"YOUR_API_KEY\"\n}' https://query.petametrics.com/v2/model | python -mjson.tool","language":"curl"},{"name":"cURL with gzip","language":"curl","code":"curl -H \"Accept-Encoding: gzip\" -H \"Content-Type: application/json\" -d '{\n  \"apiKey\" : \"527ccb8c-0f33-47e5-bff8-d9c2bcaef59e\"\n}' https://query.petametrics.com/v2/model | gunzip | python -mjson.tool"},{"language":"curl","name":"cURL v2 with query info","code":"curl -H \"Accept-Encoding: gzip\" -H \"Content-Type: application/json\" -d '{\n  \"apiKey\" : \"527ccb8c-0f33-47e5-bff8-d9c2bcaef59e\",\n  \"getQueryInfo\": true\n}' https://query.petametrics.com/v2/model | gunzip | python -mjson.tool"},{"name":"cURL with additional parameters","language":"curl","code":"curl -H \"Accept-Encoding: gzip\" -H \"Content-Type: application/json\" -d '{\n  \"apiKey\" : \"527ccb8c-0f33-47e5-bff8-d9c2bcaef59e\",\n  \"url\" : \"http://www.liftigniter.com/why_youtube_is_so_successful/\",\n  \"browsingHistory\" : [\"http://www.liftigniter.com/\", \"http://www.liftigniter.com/solutions/\", \"http://www.liftigniter.com/2016/05/\", \"http://www.liftigniter.com/blog/\", \"http://www.liftigniter.com/paradox-choice-alienating-customers/\", \"http://www.liftigniter.com/value-easy-sites-machine-learning/\", \"http://www.liftigniter.com/why_youtube_is_so_successful/\"],\n  \"userId\" : \"6766ee07-a376-4632-e55b-accc209f8099\",\n  \"getQueryInfo\" : true\n}' https://query.petametrics.com/v2/model | gunzip | python -mjson.tool"},{"code":"curl -H \"Accept-Encoding: gzip\" -H \"Content-Type: application/json\" -d '{\n  \"apiKey\" : \"527ccb8c-0f33-47e5-bff8-d9c2bcaef59e\",\n  \"itemsToRank\" : [\"http://www.liftigniter.com/solutions/\", \"http://www.liftigniter.com/company/\", \"http://www.liftigniter.com/\"],\n  \"requestFields\" : [\"title\", \"url\", \"rank\", \"thumbnail\"]\n}' https://query.petametrics.com/v2/model | gunzip | python -mjson.tool","language":"curl","name":"cURL with itemsToRank"}]},"method":"post","results":{"codes":[{"status":200,"name":"Successful response to cURL","code":"{\n    \"items\": [\n        {\n            \"rank\": \"1\",\n            \"title\": \"Liftigniter: Build Web Traffic | Improve CTR\",\n            \"url\": \"http://www.liftigniter.com/\"\n        },\n        {\n            \"rank\": \"2\",\n            \"title\": \"Product Recommendation AI - Developer Video Product Article Recommendations Engine, Mobile App Optimizely OTT Personalization |\",\n            \"url\": \"http://www.liftigniter.com/solutions/\"\n        },\n        {\n            \"rank\": \"3\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2015/01/liftigniter_logo.png\",\n            \"title\": \"Company |\",\n            \"url\": \"http://www.liftigniter.com/company/\"\n        },\n        {\n            \"rank\": \"4\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2015/08/YouTube-logo-full_color.png\",\n            \"title\": \"Why YouTube is so successful |\",\n            \"url\": \"http://www.liftigniter.com/why_youtube_is_so_successful/\"\n        },\n        {\n            \"rank\": \"5\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/10/native-ads-pixabay.png\",\n            \"title\": \"Blog\",\n            \"url\": \"http://www.liftigniter.com/blog/\"\n        },\n        {\n            \"rank\": \"6\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/05/silhouettes-616913-Pixabay-NAN-1024x768.jpg\",\n            \"title\": \"Are Marketers Getting Personalization Right? |\",\n            \"url\": \"http://www.liftigniter.com/marketers-personalization/\"\n        },\n        {\n            \"rank\": \"7\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/09/YouTube-Pixabay-1024x586.jpg\",\n            \"title\": \"How YouTube Fixed Its Traffic Problem |\",\n            \"url\": \"http://www.liftigniter.com/youtubes-fixed-traffic-problem/\"\n        },\n        {\n            \"rank\": \"8\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/05/silhouettes-616913-Pixabay-NAN.jpg\",\n            \"title\": \"May 2016\",\n            \"url\": \"http://www.liftigniter.com/2016/05/\"\n        },\n        {\n            \"rank\": \"9\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/02/Google-game-of-thrones-Fast-Company-credit.jpg\",\n            \"title\": \"February 2016\",\n            \"url\": \"http://www.liftigniter.com/2016/02/\"\n        },\n        {\n            \"rank\": \"10\",\n            \"title\": \"Machine Learning Conversion | E-Commerce Machine Learning |\",\n            \"url\": \"http://www.liftigniter.com/how-it-works/\"\n        }\n    ]\n}","language":"json"},{"language":"json","status":200,"name":"Successful response to cURL v2 with query info","code":"{\n    \"items\": [\n        {\n            \"rank\": \"1\",\n            \"title\": \"Liftigniter: Build Web Traffic | Improve CTR\",\n            \"url\": \"http://www.liftigniter.com/\"\n        },\n        {\n            \"rank\": \"2\",\n            \"title\": \"Product Recommendation AI - Developer Video Product Article Recommendations Engine, Mobile App Optimizely OTT Personalization |\",\n            \"url\": \"http://www.liftigniter.com/solutions/\"\n        },\n        {\n            \"rank\": \"3\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2015/01/liftigniter_logo.png\",\n            \"title\": \"Company |\",\n            \"url\": \"http://www.liftigniter.com/company/\"\n        },\n        {\n            \"rank\": \"4\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2015/08/YouTube-logo-full_color.png\",\n            \"title\": \"Why YouTube is so successful |\",\n            \"url\": \"http://www.liftigniter.com/why_youtube_is_so_successful/\"\n        },\n        {\n            \"rank\": \"5\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/10/native-ads-pixabay.png\",\n            \"title\": \"Blog\",\n            \"url\": \"http://www.liftigniter.com/blog/\"\n        },\n        {\n            \"rank\": \"6\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/05/silhouettes-616913-Pixabay-NAN-1024x768.jpg\",\n            \"title\": \"Are Marketers Getting Personalization Right? |\",\n            \"url\": \"http://www.liftigniter.com/marketers-personalization/\"\n        },\n        {\n            \"rank\": \"7\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/09/YouTube-Pixabay-1024x586.jpg\",\n            \"title\": \"How YouTube Fixed Its Traffic Problem |\",\n            \"url\": \"http://www.liftigniter.com/youtubes-fixed-traffic-problem/\"\n        },\n        {\n            \"rank\": \"8\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/05/silhouettes-616913-Pixabay-NAN.jpg\",\n            \"title\": \"May 2016\",\n            \"url\": \"http://www.liftigniter.com/2016/05/\"\n        },\n        {\n            \"rank\": \"9\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/02/Google-game-of-thrones-Fast-Company-credit.jpg\",\n            \"title\": \"February 2016\",\n            \"url\": \"http://www.liftigniter.com/2016/02/\"\n        },\n        {\n            \"rank\": \"10\",\n            \"title\": \"Machine Learning Conversion | E-Commerce Machine Learning |\",\n            \"url\": \"http://www.liftigniter.com/how-it-works/\"\n        }\n    ],\n    \"queryInfo\": {\n        \"advice\": [\n            \"tooLittleInfo\"\n        ],\n        \"candidateCounts\": {\n            \"all\": 32,\n            \"dedupped\": 32,\n            \"direct\": 32,\n            \"dynamic\": 31,\n            \"examined\": 32,\n            \"filtered\": 32,\n            \"filteredAndScored\": 32,\n            \"firstOrderExamples\": 32,\n            \"passedPrecombine\": 32,\n            \"passedPrejoin\": 32,\n            \"realTimeItemsAttemptedForLookup\": 32,\n            \"realTimeItemsPreInventoryLookup\": 32,\n            \"secondOrderExamples\": 0,\n            \"sorted\": 32,\n            \"static\": 0\n        },\n        \"cumulativeTimes\": {\n            \"candidateGeneration\": 17,\n            \"cleaning\": 0,\n            \"combiningAndScoring\": 18,\n            \"deduppingAndCapping\": 19,\n            \"filtering\": 18,\n            \"realTimeCompletion\": 15,\n            \"realTimeCoviewLookup\": 2,\n            \"realTimeSquish\": 4\n        },\n        \"experimentHash\": \"0\",\n        \"experimentKey\": \"default\",\n        \"matchedInventory\": \"false\",\n        \"modelServer\": \"ec2-54-153-93-252.us-west-1.compute.amazonaws.com\",\n        \"numCandidates\": \"32\",\n        \"queryTime\": \"19\",\n        \"realTimeSources\": [\n            \"popular\"\n        ]\n   "},{"code":"{\n    \"items\": [\n        {\n            \"rank\": \"1\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/05/silhouettes-616913-Pixabay-NAN-1024x768.jpg\",\n            \"title\": \"Are Marketers Getting Personalization Right? |\",\n            \"url\": \"http://www.liftigniter.com/marketers-personalization/\"\n        },\n        {\n            \"rank\": \"2\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/08/5-stages-media-personalization-Pixabay-1024x682.jpg\",\n            \"title\": \"The Five Stages of Media Personalization |\",\n            \"url\": \"http://www.liftigniter.com/five-stages-media-personalization/\"\n        },\n        {\n            \"rank\": \"3\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/02/Google-game-of-thrones-Fast-Company-credit.jpg\",\n            \"title\": \"February 2016\",\n            \"url\": \"http://www.liftigniter.com/2016/02/\"\n        },\n        {\n            \"rank\": \"4\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/09/YouTube-Pixabay-1024x586.jpg\",\n            \"title\": \"How YouTube Fixed Its Traffic Problem |\",\n            \"url\": \"http://www.liftigniter.com/youtubes-fixed-traffic-problem/\"\n        },\n        {\n            \"rank\": \"5\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/02/Google-game-of-thrones-Fast-Company-credit-1024x576.jpg\",\n            \"title\": \"Google\\u2019s Amazing Q3 & Q4 2015 Financial Results Due to Machine Learning |\",\n            \"url\": \"http://www.liftigniter.com/googles-use-of-machine-learning/\"\n        },\n        {\n            \"rank\": \"6\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/08/Social-media-SEO-Pixabay-1024x451.png\",\n            \"title\": \"Social Media Platforms That Are Best for Increasing SEO |\",\n            \"url\": \"http://www.liftigniter.com/social-media-seo/\"\n        },\n        {\n            \"rank\": \"7\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/10/native-ads-pixabay-1024x1024.png\",\n            \"title\": \"The Rise of Native Ads |\",\n            \"url\": \"http://www.liftigniter.com/rise-native-ads/\"\n        },\n        {\n            \"rank\": \"8\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2015/01/liftigniter_logo.png\",\n            \"title\": \"Company |\",\n            \"url\": \"http://www.liftigniter.com/company/\"\n        },\n        {\n            \"rank\": \"9\",\n            \"thumbnail\": \"http://www.liftigniter.com/wp-content/uploads/2016/08/Personalized-digital-magazine-Pixabay-1024x682.jpg\",\n            \"title\": \"How to Create a Personalized Digital Magazine Experience |\",\n            \"url\": \"http://www.liftigniter.com/personalized-digital-magazine/\"\n        },\n        {\n            \"rank\": \"10\",\n            \"title\": \"Machine Learning Conversion | E-Commerce Machine Learning |\",\n            \"url\": \"http://www.liftigniter.com/how-it-works/\"\n        }\n    ],\n    \"queryInfo\": {\n        \"advice\": [\n            \"tooLittleInfo\"\n        ],\n        \"candidateCounts\": {\n            \"all\": 34,\n            \"dedupped\": 27,\n            \"direct\": 32,\n            \"dynamic\": 31,\n            \"examined\": 34,\n            \"filtered\": 34,\n            \"filteredAndScored\": 27,\n            \"firstOrderExamples\": 91,\n            \"passedPrecombine\": 27,\n            \"passedPrejoin\": 34,\n            \"realTimeItemsAttemptedForLookup\": 39,\n            \"realTimeItemsPreInventoryLookup\": 39,\n            \"secondOrderExamples\": 29,\n            \"sorted\": 27,\n            \"static\": 34\n        },\n        \"cumulativeTimes\": {\n            \"candidateGeneration\": 16,\n            \"cleaning\": 0,\n            \"combiningAndScoring\": 18,\n            \"deduppingAndCapping\": 19,\n            \"filtering\": 17,\n            \"realTimeCompletion\": 15,\n            \"realTimeCoviewLookup\": 9,\n            \"realTimeSquish\": 13\n        },\n        \"experimentHash\": \"0\",\n        \"experimentKey\": \"default\",\n        \"matchedInventory\": \"true\",\n        \"modelServer\": \"ec2-54-153-93-252.us-west-1.compute.amazonaws.com\",\n        \"numCandidates\": \"27\",\n        \"queryTime\": \"19\",\n        \"realTimeSources\": [\n            \"browsingHistory\",\n            \"popular\",\n            \"order2\"\n        ]\n    }\n}","language":"json","status":200,"name":"Successful response to cURL v2 with additional parameters"},{"code":"{\n    \"items\": [\n        {\n            \"rank\": \"1\",\n            \"thumbnail\": \"https://www.liftigniter.com/wp-content/uploads/2015/01/liftigniter_logo.png\",\n            \"title\": \"Company\",\n            \"url\": \"http://www.liftigniter.com/company/\"\n        },\n        {\n            \"rank\": \"2\",\n            \"title\": \"\",\n            \"url\": \"http://www.liftigniter.com/\"\n        },\n        {\n            \"rank\": \"3\",\n            \"title\": \"Solutions\",\n            \"url\": \"http://www.liftigniter.com/solutions/\"\n        }\n    ]\n","language":"json","status":200,"name":"Successful response to cURL with itemsToRank"}]},"settings":"569740dc0b09a41900b2446b","auth":"required","params":[{"_id":"569758050b09a41900b2448a","ref":"","in":"body","required":true,"desc":"Your LiftIgniter API key.","default":"","type":"string","name":"apiKey"},{"_id":"59e909ae799d330026bd19ff","ref":"","in":"body","required":false,"desc":"The name of the widget that this request is associated with","default":"","type":"string","name":"widgetName"},{"_id":"569758050b09a41900b24489","ref":"","in":"body","required":false,"desc":"the maximum number of items you want us to return for recommendations.","default":"10","type":"int","name":"maxCount"},{"_id":"5949b243290b95002464dab7","ref":"","in":"body","required":false,"desc":"the number of items you expect to actually show. This could be less than maxCount. For a typical carousel widget, include the number of items in the initial display without users scrolling.","default":"","type":"string","name":"showCount"},{"_id":"57fa9d34f9c7091700d0d0ab","ref":"","in":"body","required":false,"desc":"When set to true, this returns additional diagnostic information on the query. Note: Not supported in v1.","default":"false","type":"boolean","name":"getQueryInfo"},{"_id":"57fa99a214f95f0e00579860","ref":"","in":"body","required":false,"desc":"The url of the current item on which you seek recommendations. Note that for non-web integrations, if the key you are using for inventory items is id, you should use id instead.","default":"","type":"string","name":"url"},{"_id":"57fa9a6a2996241700c7c1f2","ref":"","in":"body","required":false,"desc":"The unique identifier of the user for whom you want recommendations. This should match the userId being used at the activity endpoint and, if applicable, at the user endpoint.","default":"","type":"string","name":"userId"},{"_id":"57faa30114f95f0e00579868","ref":"","in":"body","required":false,"desc":"UNIX epoch timestamp in milliseconds","default":"","type":"long","name":"timestamp"},{"_id":"569758050b09a41900b24488","ref":"","in":"body","required":false,"desc":"A list of inventory fields you want us to include with each inventory item we return.","default":"[\"title\", \"url\", \"rank\", \"thumbnail\"]","type":"array_string","name":"requestFields"},{"_id":"569758050b09a41900b24487","ref":"","in":"body","required":false,"desc":"False by default. When true, it allows LiftIgniter to return only items that contain all the requested fields.","default":"false","type":"boolean","name":"requestFieldsAON"},{"_id":"58e664a0cb000c3b005b9c15","ref":"","in":"body","required":false,"desc":"List of request fields that you wish to return arrays for. This is helpful, e.g., for fields like lists of tags, categories, subtitle languages, actors, etc.","default":"","type":"string","name":"arrayRequestFields"},{"_id":"57fa99a214f95f0e00579863","ref":"","in":"body","required":false,"desc":"The maximum age in seconds of the items you want recommended. Makes sense only if you are sharing a published_time field in your inventory metadata.","default":"","type":"int","name":"maxAgeInSeconds"},{"_id":"57fa99a214f95f0e00579862","ref":"","in":"body","required":false,"desc":"A list of items that you want to exclude from the recommendations returned by LiftIgniter","default":"[]","type":"array_string","name":"excludeItems"},{"_id":"57faa30114f95f0e00579867","ref":"","in":"body","required":false,"desc":"For web or web-like user flows, this is the URL of the page that the user came from.","default":"","type":"string","name":"referrer"},{"_id":"57fa99a214f95f0e00579861","ref":"","in":"body","required":false,"desc":"A list of recently browsed items, in reverse chronological order (newest to oldest) and deduplicated. For a web flow, the items are identified by URLs. In other cases, they should be identified by the same identifier as used on inventory items.","default":"[]","type":"array_string","name":"browsingHistory"},{"_id":"57fb02eba44f4920003e9e5b","ref":"","in":"body","required":false,"desc":"Whether user activity data is used to power the recommendations. If set to false, then the recommendations are based purely on metadata. Set this option to false only when diagnosing, and not for production use.","default":"true","type":"boolean","name":"useActivity"},{"_id":"57fb0308a9d74d22003d170e","ref":"","in":"body","required":false,"desc":"Whether we match against existing inventory metadata. Set this to false only for diagnostic testing. If set to false, recommendations may be returned that do not match the inventory, and not all inventory metadata fields may be present.","default":"true","type":"boolean","name":"useInventory"},{"_id":"582554766ec2ef0f00f47786","ref":"","in":"body","required":false,"desc":"A list of item ids (urls by default) providing the set of candidates that we should rank. If empty or missing, we select the best items from your entire pool","default":"","type":"array_string","name":"itemsToRank"},{"_id":"588927bd67343c1900b74040","ref":"","in":"body","required":false,"desc":"Include this parameter ONLY if, instead of using our usual model, you want to use the model endpoint to simply return a list of globally popular or trending items. Possible values for rankingKey are described later in the document.","default":"","type":"string","name":"rankingKey"},{"_id":"588927bd67343c1900b7403f","ref":"","in":"body","required":false,"desc":"Include this parameter ONLY if, instead of using our usual model, you want to use the model endpoint to simply return a list of globally popular or trending items. Possible values for lookupKey are described later in the document.","default":"","type":"string","name":"lookupKey"},{"_id":"588927bd67343c1900b7403e","ref":"","in":"body","required":false,"desc":"Include this parameter ONLY if, instead of using our usual model, you want to use the model endpoint to simply return a list of globally popular or trending items. Possible values for lookupKey are described later in the document.","default":"","type":"int","name":"hoursBehind"},{"_id":"59a08b5ea4e2930037ac838b","ref":"","in":"body","required":false,"desc":"Identifier for the current pageview or impression. This is optional; if you send multiple queries with the same userId and pageviewId we understand that all those correspond to the same impression so we should deduplicate recommendations across them.","default":"","type":"string","name":"pageviewId"},{"_id":"59a08b5ea4e2930037ac838a","ref":"","in":"body","required":false,"desc":"Identifier for the current session of the user. Optional","default":"","type":"string","name":"sessionId"},{"_id":"59a3709e6c8a20000ffc6d94","ref":"","in":"body","required":false,"desc":"The id of the item on which you want recommendations. You will use this instead of url if you are using id as the key for your inventories (this is only for pure API integrations).","default":"","type":"string","name":"id"},{"_id":"57fa99a214f95f0e00579865","ref":"","in":"header","required":false,"desc":"If you set this to gzip, we will gzip the response, so you will need to gunzip it. Note that the final response is not affected.","default":"","type":"string","name":"Accept-Encoding"}],"url":"/model"},"isReference":true,"order":9,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"In order for us to relate the user data with the activities and model queries, you need to include the same userId value in the activity and in the model queries. If you do so, we will match the userId against the user data store and personalize our recommendations based on that information.\",\n  \"title\": \"Consistency Between User Data, Activity, And Model Queries\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Fields shared with /activity body\"\n}\n[/block]\nAs you can see from the JSON body example here and the `/activity` endpoint, the `key` fields for the JSON body is pretty similar. LiftIgniter recommends `inventory` items that fit the context of user's action. So only sending the `apiKey` does return recommendations, but it **won't be as effective as** including things like `timestamp`, `url`, `userId`, `browsingHistory`, and `referrer`. The `pageviewId` and `sessionId` fields may make sense depending on your context (we recommend sending these if you are sending the corresponding fields in the activities).\n[block:api-header]\n{\n  \"title\": \"pageviewId and deduplication\"\n}\n[/block]\nSending both `userId` and `pageviewId` allow us to deduplicate recommendations between queries that have the same pageviewId and userId (e.g., different areas on the same page). \n\nNote however that we only deduplicate if the requests are made serially; we deduplicate between a request and previous completed requests, but we do not deduplicate between requests made in parallel. If you need to make multiple requests on the same `userId ` and `pageviewId` in parallel and want deduplication, you should request more items than you need for each widget and handle the deduplication yourself. \n\nYou can see more details on deduplication in our [Query pagination](doc:query-pagination) document. Note that deduplication works only if you also send `widget_shown` events confirming that the recommendations were shown; we do not merely deduplicate between requests without confirmatory shown events.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Model Query-Specific Fields\"\n}\n[/block]\n* `maxCount` (strongly recommended) is the maximum number of items you want us to return. We technically allow a maximum value of 100, that is also the default. However, we do not guarantee being able to return more than 25 items in general. For particular user contexts and restrictive rule sets, we may return substantially fewer items than the maximum requested.</li>\n* `requestFields` is a list of inventory fields you want us to include with each inventory item we return. For each inventory item, we include only those fields among the request fields that are found in the inventory item. The default set of values of requestFields is title, url, rank, and thumbnail. However, we can also set customer-specific defaults so that you do not need to include this field in every request. The corresponding option for Javascript integration is described at [Request specific fields in recommendations](doc:request-specific-fields-in-recommendations) \n* `requestFieldsAON` is a true/false variable that is by default set to false. When true, it allows us to return only items that contain all the requested fields. The corresponding option for Javascript integrations is described at [Request specific fields in recommendations](doc:request-specific-fields-in-recommendations).\n* `maxAgeInSeconds` is the maximum age in seconds for the items you want us to return. The corresponding option for Javascript integration is described at [Set max age for recommended items](doc:set-max-age-for-recommended-items).\n* `excludeItems` is a list of identifiers for items that you want to exclude from recommendations. The corresponding option for Javascript integration is described at [Exclude items from recommendations](doc:exclude-items-from-recommendations).\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Use of the model query endpoint for reranking\"\n}\n[/block]\nThe model query endpoint can be used for reranking. To use it this way, you need to send an array of the items that you wish to rerank with the field name `itemsToRank`.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Use of the model query endpoint for deterministic lists of popular/trending items\"\n}\n[/block]\nThe model query endpoint also supports returning deterministic lists of popular and trending items. Before proceeding with this, please keep in mind that if you use these lists, there is no guarantee or expectation that the recommendation will perform well; therefore we recommend this only in cases where you specifically want to generate a list of top items and are not concerned about optimizing for CTR.\n\nHere are the parameters specific to this endpoint:\n\n* `rankingKey` is the key used to rank the items in decreasing order. The following values are allowed for rankingKey: \"click\", \"visible\", \"show\", \"click:visible\", \"click:show\", and \"visible:show\". Keys with a \":\" inside them are interpreted as ratios, so we rank in decreasing order of the ratio of the numerator to the denominator. If a value is not specified here, we return the top items but in an essentially random order.\n* `lookupKey` is a key with two possible values: \"popular\" and \"click\". The \"popular\" key restricts consideration to a shortlist of items that have received a lot of views. The \"click\" key restricts consideration to a shortlist of items that have received a lot of clicks. The default value of `lookupKey` is \"click\".\n* `hoursBehind` is the number of hours behind to go in this computation. For instance, setting this to 24 means that we will return the top items (based on `rankingKey` and `lookupKey`) over the last 24 hours.\n\nAmong the remaining parameters, we continue to use the following ones:\n\n* apiKey\n* maxCount\n* getQueryInfo (note that the specific pieces of information returned are fewer since some of the computation steps that we apply in a general model query do not apply here)\n* requestFields\n* requestFieldsAON\n\nThe remaining fields are ignored.","excerpt":"","slug":"model","type":"link","title":"/model"}