{"openapi":"3.0.0","info":{"version":"0.2.1","title":"2take.it Recommendation API","description":"API will be used to gather users activity in our promotions, portals (especially Tilido) and on some websites to analyze and give users good propositions about products and also will provide such propositions:\n \n\n- providing product recommendation data for user and history to go back to previous page/list \n - replacing previously shown product with another one after recalculation of propositions ranking\n - registering clicks on products that user see\n - registering likes / don't likes / other kind of votes for/against products\n - registering when user X logs in on browser Y (to connect hashes together) + some event metadata\n - registering browser hash / user hash metadata attributes\n - registering products (own in Tilido and third party like shops using 2ti platform)\n","termsOfService":"","contact":{"name":"2take.it","email":"ldev@2take.it","url":"http://2take.it"},"license":{"name":"Copyright 2take.it","url":"http://www.2take.it/"}},"servers":[{"url":"https://9bkmmsoxi8.execute-api.eu-central-1.amazonaws.com/dev/"},{"url":"https://recommendation.2take.it/api/"}],"paths":{"/products/{program}/{hash}/":{"get":{"description":"Returns recommended product list for a hash (user hash id or browser hash id typically). By default remembers that this products were shown already show - so won't display them on next products list taken from this endpoint except for previous page in history.","tags":["products"],"operationId":"get products","parameters":[{"name":"hash","in":"path","description":"Hash ID - any hash that is of intrest to us and identifies user browser or/and user / other","required":true,"schema":{"type":"string"}},{"name":"program","in":"path","description":"Program name","required":true,"schema":{"type":"string"}},{"name":"p","in":"query","description":"number of page requested in history, 1 is current page reload, if not present it will load next page of product or rewind to start if already all seen","required":false,"schema":{"type":"integer","format":"int32","default":1}},{"name":"rp","in":"query","description":"results per page","required":false,"schema":{"type":"integer","format":"int32","default":20}},{"name":"rem","in":"query","description":"should system remember that user seen this product in current session, could be set to 0 for debugging purposes or some strange use case","required":false,"schema":{"type":"integer","format":"int32","enum":[0,1],"default":1}},{"name":"a18","in":"query","description":"allow 18+ produts","required":false,"schema":{"type":"integer","format":"int32","enum":[0,1],"default":0}}],"responses":{"200":{"description":"products list response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"history":{"$ref":"#/components/schemas/History"},"results":{"type":"array","items":{"$ref":"#/components/schemas/Product"}}}}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/products/{program}/":{"put":{"description":"Adds products to database.","tags":["products"],"operationId":"put products","security":[{"bearer2ti":[]}],"parameters":[{"name":"program","in":"path","description":"Program name","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Product data","required":false,"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/NewProduct"}}}}},"responses":{"200":{"description":"OK response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"results":{"type":"array","items":{"$ref":"#/components/schemas/NewProduct"}}}}}}},"default":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"description":"deletes a single or multiple pet based on the ID supplied","tags":["products"],"operationId":"delete products","security":[{"bearer2ti":[]}],"parameters":[{"name":"program","in":"path","description":"Program name","required":true,"schema":{"type":"string"}},{"name":"id","in":"query","description":"ID of product to delete","required":false,"schema":{"type":"string"}},{"name":"ids","in":"query","description":"IDs list of product to delete delimitered by commas or/and spaces","required":false,"schema":{"type":"string"}}],"responses":{"204":{"description":"products deleted"},"400":{"description":"Please provide id or ids parameter"},"default":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/event/{program}/{hash}/{type}/":{"post":{"description":"Register an event happening that involves only one hash and may involve a product.","tags":["event"],"operationId":"post event","parameters":[{"name":"hash","in":"path","description":"Hash ID - any hash that is of intrest to us and identifies user browser or/and user / other","required":true,"schema":{"type":"string"}},{"name":"program","in":"path","description":"Program name","required":true,"schema":{"type":"string"}},{"name":"type","in":"path","description":"type or key","required":true,"schema":{"type":"string","description":"vote, metadata, login or other"}},{"name":"pid","in":"query","description":"product id","required":false,"schema":{"type":"string"}},{"name":"seen","in":"query","description":"do mark product as seen, ignored if pid is not set","required":false,"schema":{"type":"integer","format":"int32","enum":[0,1],"default":1}}],"requestBody":{"description":"Optional value for an event, except for type=metadata where it's required.","required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnyValue"}},"text/plain":{"schema":{"type":"string"}}}},"responses":{"200":{"description":"new replacement product response (if pid is set)","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"result":{"type":"array","items":{"$ref":"#/components/schemas/Product"}}}}}}},"204":{"description":"event registered (if pid is not set)"},"400":{"description":"Please provide non-empty request body for metadata event."},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/metadata/{program}/{hash}/":{"post":{"description":"Register a metadata change event happening. Alias for /event with metadata type and no pid.","tags":["event"],"operationId":"post metadata","parameters":[{"name":"hash","in":"path","description":"Hash ID - any hash that is of intrest to us and identifies user browser or/and user / other","required":true,"schema":{"type":"string"}},{"name":"program","in":"path","description":"Program name","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Required value for metadata (may not be empty)","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnyValue"}},"text/plain":{"schema":{"type":"string"}}}},"responses":{"204":{"description":"event registered (if pid is not set)"},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/vote/{program}/{hash}/{pid}/{v}/":{"post":{"description":"Register a product vote event happening. Sends back replacement product after recaltulating of the ranking and taking already shown products into account. Marks product as seen if not marked yet.","tags":["event"],"operationId":"post vote","parameters":[{"name":"hash","in":"path","description":"Hash ID - any hash that is of intrest to us and identifies user browser or/and user / other","required":true,"schema":{"type":"string"}},{"name":"program","in":"path","description":"Program name","required":true,"schema":{"type":"string"}},{"name":"pid","in":"path","description":"product id","required":true,"schema":{"type":"string"}},{"name":"v","in":"path","description":"vote value","required":true,"schema":{"type":"integer","enum":[-1,0,1]}}],"requestBody":{"description":"Optional value for metadata (may be empty or not sent)","required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnyValue"}},"text/plain":{"schema":{"type":"string"}}}},"responses":{"200":{"description":"new replacement product response (if pid is set)","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"result":{"$ref":"#/components/schemas/Product"}}}}}},"204":{"description":"event registered (if pid is not set)"},"400":{"description":"Please provide pid (product id) parameter when h=1 (hide) parameter is set"},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/click/{program}/{hash}/{pid}/":{"post":{"description":"Register a product click event happening. Marks product as seen if not marked yet.","tags":["event"],"operationId":"post click event","parameters":[{"name":"hash","in":"path","description":"Hash ID - any hash that is of intrest to us and identifies user browser or/and user / other","required":true,"schema":{"type":"string"}},{"name":"program","in":"path","description":"Program name","required":true,"schema":{"type":"string"}},{"name":"pid","in":"path","description":"product id","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Optional value for metadata (may be empty or not sent)","required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnyValue"}},"text/plain":{"schema":{"type":"string"}}}},"responses":{"204":{"description":"event registered"},"400":{"description":"Please provide pid (product id) parameter"},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/associate/{type}/":{"post":{"description":"Register a hash association event happening - an event that connects two hashes together (like user hash and browser hash).","tags":["event"],"operationId":"post association","parameters":[{"name":"type","in":"path","description":"Association type","required":true,"schema":{"type":"string"}},{"name":"hash1","in":"query","description":"Hash ID 1 - any hash that is of intrest to us and identifies user browser or/and user / other","required":true,"schema":{"type":"string"}},{"name":"hash2","in":"query","description":"Hash ID 1 - any hash that is of intrest to us and identifies user browser or/and user / other","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"association registered"},"400":{"description":"Please provide pid (product id) parameter when h=1 (hide) parameter is set"},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearer2ti":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"AnyValue":{"nullable":true,"description":"Can be anything in proper JSON.","example":{}},"History":{"type":"object","description":"History pagination informations object","properties":{"records_per_page":{"description":"number of records per page","type":"integer","format":"int32","example":20},"number_of_pages_in_history":{"description":"number of pages in history to go back","type":"integer","format":"int32","example":1},"is_final_page":{"type":"boolean","description":"is it the last page (so it will start over on next)","example":false},"current_page_reload_url":{"description":"url to reload currently shown page","type":"string","example":"/products/test/u-22f5a466315554132efec7f6beafc2e58af17a37/?p=1&rp=20","pattern":"^(/products/[a-zA-Z0-9 \\-]+/[A-Za-z0-9\\-]{16,70}/.*)$"},"history_url_template":{"description":"url to load previous page, %P% is template to replace with proper page number in history >= 1 (1 is currently seen page)","type":"string","example":"/products/test/u-22f5a466315554132efec7f6beafc2e58af17a37/?p=%P%&rp=20","pattern":"^(/products/[a-zA-Z0-9 \\-]+/[A-Za-z0-9\\-]{16,70}/.*)$"}}},"NewProduct":{"type":"object","description":"Product that is newly created or updated","required":["name","price","points","currency","description","image","category","category_id","link_ppc"],"properties":{"id":{"type":"string","default":"","example":"ACDC90AD2325235425423CFF23265EC5","pattern":"^([A-Fa-f0-9]{16,32})$"},"name":{"type":"string","default":"","example":"Molson Canadian","pattern":"^(.*)$"},"price":{"type":"number","default":0.0,"example":33.44},"points":{"type":"integer","default":0,"example":4},"currency":{"type":"string","default":"PLN","example":"PLN","pattern":"^(.+)$"},"description":{"type":"string","default":"","pattern":"^(.*)$"},"image":{"type":"string","default":"","example":"https://static.beerlovers.pl/wp-content/uploads/2015/12/imports/post-15308-_thumbnail_id.jpg","pattern":"^((?:http:\\/\\/|https:\\/\\/|\\/\\/).*)$"},"category":{"type":"string","default":"","example":"Beer Lovers / Piwo / Lager","pattern":"^(.*)$"},"category_id":{"type":"string","default":"","example":"33345523AF3456456","pattern":"^([0-9A-F]{16,32})$"},"link_ppc":{"type":"string","default":"","pattern":"^(.*)$"},"link_ppv":{"type":"string","default":"","pattern":"^(.*)$"},"adult_only":{"type":"integer","default":0,"example":1,"enum":["0. 1"]}}},"Product":{"type":"object","description":"Product result","allOf":[{"$ref":"#/components/schemas/NewProduct"}],"required":["id","program","modified","vote","adult_only","link_ppc"],"properties":{"link_ppc":{"description":"Link that will redirect to original link_ppc saved","type":"string","default":"","example":"/open?h=u-22f5a466315554132efec7f6beafc2e58af17a37&pid=ACDC90AD2325235425423CFF23265EC5","pattern":"^(/open?h=[A-Za-z0-9\\-]{16,70}&pid=[A-Fa-f0-9]{16,32})$"},"link_ppv":{"description":"Link that will redirect to original link_ppv saved","type":"string","default":"","example":"/open?pp=v&h=u-22f5a466315554132efec7f6beafc2e58af17a37&pid=ACDC90AD2325235425423CFF23265EC5","pattern":"^(/open?pp=v&h=[A-Za-z0-9\\-]{16,70}&pid=[A-Fa-f0-9]{16,32})$"},"program":{"type":"string","default":"","example":"2ti","pattern":"^(.*)$"},"modified":{"type":"string","default":"","example":"2018-10-01 11:33:44","pattern":"^(20[1-9][0-9]-(?:0[0-9]|1[0-2])-(?:[0-2][0-9]|3[0-1]) (?:[0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$"},"vote":{"type":"integer","default":0,"example":1,"enum":["-1. 0. 1"]}}},"Error":{"required":["status"],"properties":{"status":{"type":"string","pattern":"^([A-Za-z0-9 \\-]+)$","example":"NOT FOUND"},"message":{"type":"string","description":"may contain additional debugging message"}}},"OK":{"required":["status"],"properties":{"status":{"type":"string","pattern":"^OK$","example":"OK"},"message":{"type":"string","description":"may contain additional debugging message"}}}}}}