User Tools

Site Tools


pci_doku

Picalike Customer Interface

Host: pci01.picalike.corpex-kunden.de

Port: 8090

Dependencies

passlib==1.6.5

git

Im git zu finden als:

$ git clone git@git.picalike.corpex-kunden.de:picalike/pci.git

Operations

check upci

Allgemeines

Anfragen mit json als post

Antworten:

  • als json
  • immer “message” <str> und “result” <int>
  • negativer “result” bedeutet Error
  • positiver “result” ist Grund zur Hoffnung
  • in “response” steht die Antwort auf die Frage

Test User:

"email" : "unittest@picalike.com",
"password_for_testing" : "picalike",
"userid" : "f6622021aae19fd282df4945a3a47aa8",
"username" : "unittest",
"uid" : [905]

Image Cache Server

Host: sg02.picalike.copex-kunden.de

Port: 8095

Aufrufbeispiel:

http://sg02.picalike.corpex-kunden.de:8095/<url_enc>
http://sg02.picalike.corpex-kunden.de:8095/http%3A%2F%2Fwww.picalike.com%2Fdesign%2Fpicalike%2Flogo.png

Der Server gibt die Datei zurück. Wenn nötig wird sie heruntergeladen, wenn möglich wird die gespeicherte Version aus dem Cache ausgespielt.

Zusätzlich gibt es die Möglichkeit die Bilder direkt resized zu bestellen, es wird grundsätzlich die Aspectratio beibehalten (wenn width zu height nicht passt gewinnt der größere Wert, der andere wird ignoriert):

http://sg02.picalike.corpex-kunden.de:8095/<url_enc>/width/height

Es braucht nur width oder height angegeben werden, der andere kann auf -1 gesetzt werden.

Apis

http://<host>:<port>/<api>

Testing with curl:

curl --data-binary @style_count.json -H "Content-type: application/json" "http://pci01.picalike.corpex-kunden.de:8090/style_count"

where style_count.json is a file containing the message that you want to send

/login

in:

{"email": <str>, "pwd": <str>}

out:

{
  "result": 2, 
  "message": <str>, 
  "response": {
    "userid": <str>, 
    "username": <str>,
    "sid": <str>,  # new session id
    "lang": <str>,  # default: 'en', if not set
    "fav_shop": <str, shop_id>  # only if it is set
    "shop_info": [{"shop_name": <str>, "apikey": <str>}], 
    "privileges": [<str>, ...], 
    "role": <str, default=user>, 
    "create_date": <datum>
  }
}

/delete_user

in:

{"userid": <str>}

out:

{"result": 1, "message": <str>, "response": {}}

/get_available_permissions

in:

{}

out:

{"result": <int>, "message": <str>, "response": {"permissions": [<str>, ...]}}

/user_by_shop

in:

{"shop_apikey": <str>, "include_all": <bool>}

include_all is optional and by default False, if True all users that include “all” in “uid” will be returned

out:

{"result": <int>, "message": <str>, "response": {"user_list": [{"username": <str>, "userid": <str>, "role": <str, default=user>}, ...]}}

/change_role

in:

{"userid": <str>, "role": <str>}

out:

{"result": <int>, "message": <str>, "response": {}}

/change_pwd

in:

{"userid": <str>, "pwd": <str>}

out:

{"result": <int>, "message": <str>, "response": {}}

/change_permissions

in:

{"userid": <str>, "permissions": [<str>, ...]}

out:

{"result": <int>, "message": <str>, "response": {}}

/user_data_by_sessionid

in:

{"sid": <str>}  # sessionid

out:

{"result": 1, "message": "OK", "response": {
  "userid": <str>, 
  "username": <str>,
  "email". <str>,
  "shop_info": [{"shop_name": <str>, "apikey": <str>}],
  "fav_shop": <str>  # only if it is set
  "privileges": [<str>, ...], 
  "role": <str, default=user>,
  "lang": <str>, 
  "create_date": <datum>
}}

/get_user

in:

{"userid": <str>}

out:

{"result": 1, "message": "OK", "response": {
  "userid": <str>, 
  "username": <str>, 
  "shop_info": [{"shop_name": <str>, "apikey": <str>}],
  "fav_shop": <str>  # only if it is set
  "privileges": [<str>, ...], 
  "role": <str, default=user>,
  "lang": <str>, 
  "create_date": <datum>
}}

/set_language

in:

{"userid": <str>, "lang": <str>}

out:

{"result": 1, "message": "OK", "response": {}}

lang is a two letter string, e.g.: 'de', 'en', …

/set_favorite_shop

in:

{"userid": <str>, "shop_id": <str>}

out:

{"result": 1, "message": "OK", "response": {}}

/check_session

in:

{
  "userid": <str>, 
  "sid": <str>,
  "action": <str, default: "unknown" if missing>,
  "shop_id": <str, default: "unknown" if missing>
  # optional
  "data": <dict, for additional data>  # not used right now
}

out:

{"result": 1, "message": "OK", "response": {"match": <bool>}}

/admin_user_stats

in:

{
  "sid": <str>,  # authorization
  "userid": <str>,  # stats for this user
  "shop_id": <str>  # and this shop
}

out:

{"result": 1, "message": "OK", "response": [
    {
      "date": <str, "%Y-%m-%d">  # e.g. "2019-02-01"
      "first": <str, "%Y-%m-%dT%H:%M:%SZ">  # first activity of the day in UTC, e.g. "2019-02-01T08:01:11Z"
      "last": <str, "%Y-%m-%dT%H:%M:%SZ">  # last activity of the day in UTC, e.g. "2019-02-01T18:03:51Z"
      "count": <int>  # total number of actions (calls to check_session)
      "details": <dict>  # <action> -> <count>
    }
]}

in:

{"from_time": <str>, "to_time": <str>, "resolution": <hour, day, month>, "userid": <str>, "shop_apikey": <str>}

Zeiten als String in der Form: 2015-12-06 11:55

“resolution”: “hour” nicht möglich bei stats_color

out:

{"result": 1, "message": "OK", "response": {"sum_list": {<int>: {"time": <str_date>, "sum": <int>}, ... }}}

Anmerkung:

Der Zeitstempel (z.B. “2015-11-30 10:00:00.000”) meint den Beginn der Zeitspanne (Beisp. endet hier bei “2015-11-30 10:59:59.999)

/stats_color

in:

{"from_time": <str>, "to_time": <str>, "resolution": <hour, day, month>, "userid": <str>, "shop_apikey": <str>}

Zeiten als String in der Form: 2015-12-06 11:55

“resolution”: “hour” nicht möglich bei stats_color

out:

{"result": 1, "message": "OK", "response": {"sum_list": [{"time": <str_date>, "sum": <int>}, ... ]}}

Anmerkung:

Der Zeitstempel (z.B. “2015-11-30 10:00:00.000”) meint den Beginn der Zeitspanne (Beisp. endet hier bei “2015-11-30 10:59:59.999)

/categories (deprecated use get_field_values instead)

in:

{"userid": <str>, "shop_apikey": <str>}

out:

{"result": 1, "message": "OK", "response": {"categories":[{"name": <str>, "count": <int>, "gender": <str,"None">, "f_value": <float,"no f_value">, "available": <bool,"no available_info"}]}}

/get_field_values

Alle Werte im Feed (unified) anzeigen:

in:

{"userid": <str>, "shop_apikey": <str>, "field_name": <str> (categories, brands, colors, shops, season)}

out:

{"result": 1, "message": "OK", "response": {"field_values":[...]}}

categories:
{"name": <str>, "count": <int>, "gender": <str,Null>, "f_value": <float,Null>, "available": <bool,default:true}

brands, colors, shops, gender, season:
{"brand/color/shop/gender/season": <str>, "size": <int>}

Nur die Werte innerhalb einer Kategorie (unified) anzeigen:

in:

{"userid": <str>, "shop_apikey": <str>, "field_name": <str> (brands, colors, shops, gender, season), "category": <str>}

out:

{"result": 1, "message": "OK", "response": {"field_values":[<str>]}}

/get_categories_translation

in:

{"shop_apikey": <str>}

out:

{"result": 1, "message": "OK", "response": {"translation":{<cat_int, str>: <cat_visulytics, str>, ...}}}

/update_categories_cache

(for internal use only)

in:

{"shop_apikey": <str>}

out:

{"result": 1, "message": "OK", "response": {}}

/save_f_value

in:

{"userid": <str>, "shop_apikey": <str>, "category": <str>, "f_value": <float>, "gender": <str,None>}

out:

{"result": 1, "message": "OK", "response": {}}

/get_f_values

in:

{"userid": <str>, "shop_apikey": <str>, "categories": [<str>]}
{"userid": <str>, "shop_apikey": <str>, "categories": [<str>], "gender": <str>}

out:

{"result": 1, "message": "OK", "response": {"f_values": {"category": <str>, "f_value": <float>, "gender": <str>}}}

:?: Bitte categories auf encoding Probleme testen.

/save_mapping

in:

{"userid": <str>, "shop_apikey": <str>, "customer_cat": <str>, "picalike_cat": <str>, "visual": <bool, None>, "gender": <str,None>}

out:

{"result": 1, "message": "OK", "response": {}}

/get_mapping

in:

{"userid": <str>, "shop_apikey": <str>}

out:

{"result": 1, "message": "OK", "response": {"mapping": [{"customer_cat": <str>, "picalike_cat": <str>, "suggested_cat": <str>, "gender": <str>, "visual": <bool>}]}}

/picalike_categories

in:

{"userid": <str>}

out:

{"result": 1, "message": "OK", "response": {"categories": [<str>]}}

/picalike_fashion_categories

in:

{"userid": <str>}

out:

{"result": 1, "message": "OK", "response": {"categories": [[<str>, <str>], ...]}}

/products

in:

{"userid": <str>, "shop_apikey": <str>, "page": <int,0>, "limit": <int,50>, "sort_key_direction": <str,{"ASC"(default), "DESC"}>}
{"userid": <str>, "shop_apikey": <str>, "cat_name": <str>, "page": <int,0>, "limit": <int,50>}
{"userid": <str>, "shop_apikey": <str>, "gender": <str>, "page": <int,0>, "limit": <int,50>}
{"userid": <str>, "shop_apikey": <str>, "available": <bool>, "page": <int,0>, "limit": <int,50>}
{"userid": <str>, "shop_apikey": <str>, "season": <str>, "page": <int,0>, "limit": <int,50>}
{"userid": <str>, "shop_apikey": <str>, "type": <str>, "page": <int,0>, "limit": <int,50>}
{"userid": <str>, "shop_apikey": <str>, "color": <str>, "pColor": <bool>, "page": <int,0>, "limit": <int,50>}  
{"userid": <str>, "shop_apikey": <str>, "page": <int,0>, "limit": <int,50>, "filter_price": {"lower": <float,0>, "upper": <float,1e6>}}
{"userid": <str>, "shop_apikey": <str>, "cat_name": <str>, "page": <int,0>, "limit": <int,50>, "filter_price": {"lower": <float,0>, "upper": <float,1e6>}}
filter_price ist nachgelagern, Anzahl der Produkte kann kleiner sein als limit. Filterung auf gesammten Daten möglich aber teurer.
gender, available, cat_name, season, type und color können kombiniert werden
wenn "color" ein picalikeColor ist, muss "pColor": true ("pColor": false für "color" aus dem Feed)
mittels "unify": true können die Bilder-Urls auf Einmaligkeit gefiltert werden (möglichst nur mit cat_name, ist bei großen Datenmengen sehr langsam)

out:

{"result": 1, "message": "OK", "response": {"products":[{"name": <str>, "price": <str>, "url": <str>, "imgid": <str>, "deeplink": <str>, "gender": <str>, "season": <str>, "type": <str>, "color": <str>}]}}

/products_by_random

in:

{"userid": <str>, "shop_apikey": <str>, "limit": <int,50>}

out:

{"result": 1, "message": "OK", "response": {"products":[{"name": <str>, "price": <str>, "url": <str>, "imgid": <str>, "deeplink": <str>, "gender": <str>}]}}

/product_by_views

in:

{"userid": <str>, "shop_apikey": <str>, "from_time": <str>, "to_time": <str>, "productid": <str>}
{"userid": <str>, "shop_apikey": <str>, "from_time": <str>, "to_time": <str>, "productid": <str>, "resolution": <hour, day, month>}
Zeiten als String in der Form: 2015-12-06 11:55

out:

{"result": 1, "message": "OK", "response": {"product_count": <int>}}
{"result": 1, "message": "OK", "response": {"product_count": <int>, "sum_list": {<int>: {"time": <str_date>, "sum": <int>}, ... }}}

/product_by_views_30

in:

{"userid": <str>, "shop_apikey": <str>, "productid": <str>}

out:

{"result": 1, "message": "OK", "response": {"product_count": <int>, "sum_list": {<int>: {"time": <str_date>, "sum": <int>}, ... }}}

/top_views

in:

{"userid": <str>, "shop_apikey": <str>, "from_time": <str>, "to_time": <str>, "limit": <int,10>}
Zeiten als String in der Form: 2015-12-06 11:55
mittels "update_cache": <egal> kann der cache in der mongo neu geschrieben werden

out:

{"result": 1, "message": "OK", "response": {"top_views": [{"productid": <str>, "amount": <int>}]}}
Bei gleicher Häufigkeit ist die Sortierung undefiniert.

/get_products_metaData

in:

{"userid": <str>, "shop_apikey": <str>, "productids": [<str>], "cat_name": <str>, "image_id_delimiter": <char>, "n_image_id_chunks": <int>, "extra_fields": <list of strings>}
Optional:
cat_name - filter by cat,
image_id_delimiter - split image_id at delimiter,
n_image_id_chunks - number of chunks to keep,
extra_fields

out:

{"result": 1, "message": "OK", "response": {"products":[{"name": <str, None>, "price": <str, None>, "url": <str, None>, "imgid": <str, None>, "deeplink": <str, None>, "available": <bool, None>, "cat": <str, None>, "season": <str>, "type": <str>, "color": <str>, "pColor": <str>}]}}

out_with_extra_field(s):

The ouput is exactly the same as for a request without any option, but the query from the pci app to MongoDB pcistyles collection will only respond with items containing the field extra_image_filter with the value extra_image_exists.

/colors

in:

{"userid": <str>, "shop_apikey": <str>}
{"userid": <str>, "shop_apikey": <str>, "category": [<str>], "gender": <str>}
category und gender optional und frei kombinierbar

out:

{"result": 1, "message": "OK", "response": {"related_products": <int>, "color_statistic":[{"color_name": <str>, "avg_amount": <float>, "found_count": <int>, "found_percent": <float>}]}}

related_products: Anzahl der gefundenen Produkte
avg_amount: Durchschnittlicher Anteil dieser Farbe in allen Bildern die diese Farbe haben
found_count: Anzahl der Bilder die diese Farbe haben
found_percent: (found_count / related_products)

/get_colors

in:

{"userid": <str>, "shop_apikey": <str>}

out:

{"result": 1, "message": "OK", "response": {"color_names":[<str>]}}

/search_by_color

in:

{"userid": <str>, "shop_apikey": <str>, "color_name": <str>, "limit": <int,10>, "page": <int,0>}
{"userid": <str>, "shop_apikey": <str>, "color_name": <str>, "limit": <int,10>, "page": <int,0>, "cat_name": <str>, "gender": <str>}
cat_name und gender optional und frei kombinierbar

out:

{"result": 1, "message": "OK", "response": {"products":[{"productid": <str>, "amount": <float>}]}}
products sind absteigend sortiert nach Anteil der Farbe am Produkt

/colors_by_views

in:

{"userid": <str>, "shop_apikey": <str>, "from_time": <str>, "to_time": <str>}
Zeiten als String in der Form: 2015-12-06 11:55

out:

{"result": 1, "message": "OK", "response": {"related_products": <int>, "color_statistic":[{"color_name": <str>, "amount": <int>]}}

/color_filter

Returns a list of all colors in a feed or a list of all picalike colors if the former is not available.

in:

{"userid": <str>, "shop_apikey": <str>,"pColor": <bool>}
"pColor": true forces use of picalike colors

out:

{"result": 1, "message": "OK", "response": {"colors": [<str>], "pColor": <bool>}}
"pColor": true if picalike colors are returned

/replace_product

in:

{"userid": <str>, "shop_apikey": <str>, "ref_pid": <str>, "new_prod": <dict with product info>}
  • <dict with product info>: dict mit allem, was man sich für das Produkt merken muss (same as save_style/update_style)
  • “ref_pid”: product id of the product that has to be replaced

out:

{"result": 1, "message": "OK", "response": {"num_updated_styles": <int>}}
  • num_updated_styles: number of updated styles where ref_pid was found

/save_style

in:

{"userid": <str>, "shop_apikey": <str>, "name": <str>, "type": <str>, "order_by": <int>, "products": <dict of products>}
  • <dict of products>: dict mit allem, was man sich für das Produkt merken muss (“img (imgId)(str)”, “f”(str of an float), “dist” (str of float), “cat”(str), “gender”, “season”)
  • optional: “tags” (format is not specified, has to be JSON/mongo compatible)
  • optional: “visibility” (default: “preview”)
  • hidden option: “build_cache”: <bool> (default: True)
  • Dict Template: {“p1” : {} .., p2:{}}

out:

{"result": 1, "message": "OK", "response": {"styleid": <str>, "userid": <str>, "name": <str>, "type": <str>, "modified": double, "created": double, "visibility": <str>, "products": <list of products>}}
  • modified: timestamp
  • created: timestamp
  • visibility: [“public”, “preview” (default), “delete”]

/copy_style_to_shop

this will replace some SKUs for Atelier Goldner Schnitt if the following settings are present in the feed settings:

  • visualytics.image_id_delimiter
  • visualytics.n_image_id_chunks
  • style_updater.in_stock_value

in:

{"userid": <str>, "from_shop_apikey": <str>, "to_shop_apikey": [<str>], "styleid": [<str>]}
  • to_shop_apikey and styleid should always be lists
  • optional: *copy_on_error*: <bool> (default: False) - if True, style will be copied even if product ids are missing

out:

{"result": 1, "message": "OK", "response": 
  {<to_shop_apikey>: 
    {"copied": [<str>], 
     "errors": [{styleid: <str>, "msg": <str>}], 
     "missing": [{styleid: <str>, "prod_ids": [<str>]}]
    }
  }
}
  • response is a dictionary with the to_shop_apikeys as key
  • copied contains a list of styleids that were copied
  • errors contains a list of styleids that were not copied (reasons/msg: [“name in use”, “missing product ids”, “unknown error”])
  • missing contains a list of styleids and the product ids that are missing in the destination shop

/check_style_name

in:

{"shop_apikey": <str>, "name": <str>}

out:

{"result": 1, "message": "OK", "response": {"exists": <bool>}}

/update_style

in:

{"styleid": <str>, "shop_apikey": <str>, ...}
  • Jedes Feld aus der Antwort von “save_style” kann angegeben werden.
  • Die Liste der Produkte muss entweder komplett oder gar nicht angegeben werden.
  • “modified” wird immer auf die Zeit des API-Aufrufs gesetzt
  • Felder die nicht “save_style” definiert sind, werden ignoriert
  • hidden option: “build_cache”: <bool> (default: True)

out:

{"result": 1, "message": "OK", "response": {...}}
  • …: gibt den geupdatete Style zurück (siehe “save_style”)

/get_style

in:

{"styleid": <str>, "shop_apikey": <str>}

out:

{"result": 1, "message": "OK", "response": {...}}
  • …: Rückgabe wie bei “save_style”
  • Es werden an dieser Stelle keine Empfehlungen mit zurückgegeben, um die API sauber und minimal zu halten.

/style_count

in:

{"shop_apikey": <str>}

out:

{"result": 1, "message": "OK", "response": {"style_count": <int>}}

/style_cover

in:

{"shop_apikey": <str>}
{"shop_apikey": <str>, "renew": <bool>}

out:

{"result": 1, "message": "OK", "response": {"all": <float>, <cat_name>: <float>, ...}}

/list_styles

in:

{"shop_apikey": <str>, "limit": <int,150>, "page": <int,0>}

out:

{"result": 1, "message": "OK", "response": [...]}
  • response: Eine Liste mit Styles. Felder sind so benannt wie auch schon bei “save_style”

/list_all_styles

in:

{"shop_apikey": <str>}

out:

{"result": 1, "message": "OK", "response": [...]}
  • response: Eine Liste mit Styles. Felder sind so benannt wie auch schon bei “save_style”

/update_styles_cache

in:

{"shop_apikey": <str>}

out:

{"result": 1, "message": "OK", "response": {}}
  • response: ein leeres Dictionary

/delete_style

in:

{"styleid": <str>, "shop_apikey": <str>, "userid": <str>}
  • hidden option: “build_cache”: <bool> (default: True)

out:

{"result": 1, "message": "OK", "response": {}}

/all_recoboxes

in:

{"userid": <str>, "shop_apikey": <str>,}

out:

{"result": 1, "message": "OK", "response": [{"userid": <str>, "shop_apikey": <str>, "box_id": <str>, "reco_type": (look|sim)<str>, "mode": (live|preview)<str>, "referrer": <boolean>, "only_if_unavailable": <boolean>, "box_name": <str>, "creation_time": <int>, "status": (active|deleted)<str>, "template": <str>}]}

Falls keine Recobox gespeichert ist, ist der Wert von response eine leerer Array. Der Wert von creation_time ist im Format “seconds since epoch”.

/read_recobox

in:

{"userid": <str>, "shop_apikey": <str>, "box_id": <str>}

out:

{"result": 1, "message": "OK", "response": [{"userid": <str>, "shop_apikey": <str>, "box_id": <str>, "reco_type": (look|sim)<str>, "mode": (live|preview)<str>, "referrer": <boolean>, "only_if_unavailable": <boolean>, "box_name": <str>, "creation_time": <int>, "status": (active|deleted)<str>, "template": <str>, "regex": <str>}]}

Falls keine Recobox vorhanden ist, ist der Wert von response eine leerer Array. Der Wert von creation_time ist im Format “seconds since epoch”.

/delete_recobox

in:

{"userid": <str>, "shop_apikey": <str>, "box_id": <str>}

out:

{"result": 1, "message": "OK", "response": {"matched_count": <int>}}

Der Wert von matched_count ist die Anzahl der auf status=deleted gesetzten Einträge.

/save_recobox

in:

{"userid": <str>, "shop_apikey": <str>, "box_id": <str>,
"reco_type": <str>, "mode": (live|preview)<str>, "box_name": <str>, "template": <str>, "regex": <str>,
"referrer": <boolean>, "only_if_unavailable": <boolean>}

Alle Parameter außer “userid”, “shop_apikey”, “box_id” sind optional. Boolean wird hier wie folgt interpretiert: ein leerer String ist false und ein nicht-leerer String true.

out:

{"result": 1, "message": "OK", "response": {}}

/edit_recobox

in:

{"userid": <str>, "shop_apikey": <str>, "box_id": <str>,
"reco_type": (sim|look)<str>, "mode": (live|preview)<str>, "box_name": <str>, "template": <str>, "regex": <str>,
"referrer": <boolean>, "only_if_unavailable": <boolean>}

Alle Parameter außer “userid”, “shop_apikey”, “box_id” sind optional. Boolean wird hier wie folgt interpretiert: ein leerer String ist false und ein nicht-leerer String true.

out:

{"result": 1, "message": "OK", "response": {}}

/stats_clicks

in:

{"userid": <str>, "shop_apikey": <str>, "from_time": <str>, "to_time": <str>}

oder:

{"userid": <str>, "shop_apikey": <str>, "from_time": <str>, "to_time": <str>, "testid": <str>, "test_class": <str>}

Zeiten als String in der Form: 2015-12-06 11:55 “test_class” ist z.B. “A”

out:

{"result": 1, "message": "OK", "response": {"click_stats": {<type>: {<datum> : <int>}}, "todays_prediction": {<type>: <int>}}}

<type> in der Form “sim_*” oder “look_*”

<datum> als String in der Form: 2015-12-06

“todays_prediction” ist nicht leer nur wenn “to_time” == heute

/stats_checkouts

in:

{"userid": <str>, "shop_apikey": <str>, "from_time": <str>, "to_time": <str>}

oder

{"userid": <str>, "shop_apikey": <str>, "from_time": <str>, "to_time": <str>, "testid": <str>, "test_class": <str>}

Zeiten als String in der Form: 2015-12-06 11:55 “test_class” ist z.B. “A”

out:

{"result": 1, "message": "OK", "response": {"checkout_stats": [{"date": <str>, "not_found": <int>, "products": <int>, "value": <int>, "checkouts": <int>, "sessions": <int>}], "todays_prediction": {"sessions": <int>, "checkouts": <int>}}}

“date” in der Form: 2015-12-06

“value” als Cents

“todays_prediction” ist nicht leer nur wenn “to_time” == heute

/top_clicked

in:

{"userid": <str>, "shop_apikey": <str>, "from_time": <str>, "to_time": <str>, "limit": <int>}

Zeiten als String in der Form: 2015-12-06 11:55

out:

{"result": 1, "message": "OK", "response": {"top_clicked": [[imgId, n_clicks], ...]}}

“top_clicked” ist eine high-to-low sortierte Liste.

/ab_config/create

in:

{"userid": <str>, "shop_apikey": <str>, "from_time": <str>, "to_time": <str>, "status": <bool>, "prob_a": <float>, "name": <str>, "testid": <str>, "description": <str>}

from_time und to_time als String im Format: “2015-11-30 10:00”.

status (activity status)

prob_a (probability parameter in real-valued range [0, 1], i.e. 0.856)

out:

{"result": 1, "message": "OK", "response": {"status": <str>, "testid": <str>}}

/ab_config/get_ab_tests

in

{"userid": <str>, "shop_apikey": <str>}

out:

{"result": 1, "message": "OK", "response": {"ab_tests": [{"shop_apikey": <str>, "from_time": <str>, "to_time": <str>, "status": <bool>, "prob_a": <float>, "name": <str>, "testid": <str>, "description": <str>}]}}

/trend_create

Parameters and files are passed as form fields (content-type=multipart/form-data)

in:

userid=<str>, name=<str>, sources=<list>, gender=<str>, age=<list>, weather=<list>, segment=<list>, categories=<list>, country=<list>, status=<str>, hashtags=<str>, description=<str>, image_i=new, file_i=<file>, style_i=<list>, cpc_i=<list>
  • mandatory: userid and name
  • to add image i set image_i=new, where i is from the set {1, …, 9} and provide file_i
  • status is a string from the set {“preview”, “active, “deleted”}
  • <list> is a string where items are separated by ;

out:

{"result": 1, "message": "OK", "response": {"trendid": <str>}}

/trend_info

in:

{"userid": <str>, "trendid": <str>}

out:

{"result": 1, "message": "OK", "response": {"trend_info": {"userid": <str>, "name": <str>, "trendid": <str>, "created": <str>, "edited": <str>, "sources" [<str>, ...], "gender": <str>, "age": [<str>, ...], "weather": [<str>, ...], "segment": [<str>, ...], "categories": [<str>, ...], "country": [<str>, ...], "status": {"preview", "active, "deleted"}, "hashtags": <str>, "description": <str>, "images": {"image_1": {"file_id": <str>, "style": <str>, "cpc": <str>}, "image_2": {"file_id": <str>, "style": <str>, "cpc": <str>}, ...}}}}
  • images: dictionary with keys image_i, where i is from the set {1, …, 9}
  • image_i contains file_id, style and cpc (central product category) for image i

/trend_edit

Parameters and files are passed as form fields (content-type=multipart/form-data)

in:

userid=<str>, name=<str>, sources=<list>, gender=<str>, age=<list>, weather=<list>, segment=<list>, categories=<list>, country=<list>, status=<str>, hashtags=<str>, description=<str>, image_i=<cmd>, file_i=<file>, style_i=<list>, cpc_i=<list>
  • mandatory: userid, trendid
  • status is a string from the set {“preview”, “active, “deleted”}
  • <list> is a string where items are separated by ;
  • <cmd> is a string from the set {“new”, “edit”, “del”}
  • add or replace image (and attributes): image_i=new and provide file_i
  • delete image and its attributes: image_i=del
  • edit image attributes: image_i=edit

out:

{"result": 1, "message": "OK", "response": {}}

/trend_delete

in:

{"userid": <str>, "trendid": <str>}

out:

{"result": 1, "message": "OK", "response": {}}

/trend_list

in:

{"userid": <str>, "status": [<str>, ...], "n_images": <int>}
  • mandatory: userid
  • optional:
  • status: list of elements from set {“preview”, “active”, “deleted”}
  • n_images: maximal number of images for each trend

out:

{"result": 1, "message": "OK", "response": {"trends": [{"trendid": <str>, "name": <str>, "created": <str>, "userid": <str>, "status": <str>, "categories": [<str>, ...], "images": [<str>, ...]}, ...}}
  • images: list of file id's

/trend_image/<file_id>

Image with database _id = file_id is returned

/upload

Parameters and files are passed as form fields (content-type=multipart/form-data)

in:

{userid:<str>, image_1:<file> , "shop_apikey" : <str> }
  • image_1 is a input with type=file.
  • It stores the image in the collection 'pci_upload', than, makes the request to the tower01 prediction API, returning response Json in the end.
  • The predictions are made with: big_net : true, fasterrcnn_microworker: true, free_person: true.

out:

{"result": 1, "message": "OK", "response":  {"_id":<str> ,  'images_with_fatal_error':<list> ,'urls_with_image_cloud_error': <list> , 'images_without_error': { <key> : "bits": [[bit, value], ...] , "attributes": [[name, value], ...] , "categories": [[name, value], ...] , "free_person": [[name, value], ...] , 'fasterrcnn_microworker_boxes':   [{'x1': <double>, 'x2': <double>, 'score': <str>, 'y2': <double>, 'class': <str>, 'y1': <double> }, ... ] } } }

/get_image/<file_id>

Just a endpoint to the upload system, this endpoint serve as the http link that the tower01 needs to do the predictions. The method send the image from the collection 'pci_upload'.

/upload_list>

in:

{userid:<str> , shop_apikey : <str> }

out:

{"result": 1, "message": "OK", "response": [{"_id":<str> ,"uploadDate"  : <str> , "userid" : <str> } , {"_id": <str> ,"uploadDate" : <str> , "userid" : <str> } ,...  ] }

* Lists all the _id of uploaded images, by shop_apikey, in the upload system.

/upload_view>

in:

{userid:<str> , shop_apikey : <str>, file_id:<str> }

out:

{"result": 1, "message": "OK", "response": {"new_prediction" : {"_id":<str> ,  'images_with_fatal_error':<list> ,'urls_with_image_cloud_error': <list> , 'images_without_error': { <key> : "bits": [[bit, value], ...] , "attributes": [[name, value], ...] , "categories": [[name, value], ...] , "free_person": [[name, value], ...] , 'fasterrcnn_microworker_boxes':   [{'x1': <double>, 'x2': <double>, 'score': <str>, 'y2': <double>, 'class': <str>, 'y1': <double> }, ... ] } } }} 

/get_image_data>

in:

{userid:<str> , shop_apikey : <str>, file_id:<str> }

out:

{"result": 1, "message": "OK", "response": {"_id":<str> ,  'images_with_fatal_error':<list> ,'urls_with_image_cloud_error': <list> , 'images_without_error': { <key> : "bits": [[bit, value], ...] , "attributes": [[name, value], ...] , "categories": [[name, value], ...] , "free_person": [[name, value], ...] , 'fasterrcnn_microworker_boxes':   [{'x1': <double>, 'x2': <double>, 'score': <str>, 'y2': <double>, 'class': <str>, 'y1': <double> }, ... ] } } }
   

/set_style_exact_match

in:

{userid:<str> , shop_apikey : <str>, styleid:<str>, exact_match: <bool> }

out:

{"result": 1, "message": "OK", "response": {"exact_match":<bool>} }

Collections

  • pci_categories
  • wird automatisch mit dem Skript “update_categories.py” erzeugt.
  • Läuft als cronjob auf sg02.
  • Kann manuell ausgeführt werden.
  • Läuft recht lang. (abhängig von der Anzahl und Größe der Kunden)
  • pci_f_values
  • in dieser Collection werden Benutzereingaben gespeichert
  • pci_mapping
  • wird noch nicht verwendet
  • pci_user
  • in dieser Collection werden Benutzer und deren Rechte in Visuallytics gespeichert
  • pci_history
  • stündliche Summation der Abfragen für einen Kunden (Skript “add_history_every_hour.py”)
  • Cronjob auf sg02
  • Index
  • time
  • time, uid
  • pci_products_history
  • tägliche Summation der Abfragen je Produkt (Skript “add_product_history_every_day.py”)
  • Cronjob auf sg02
  • Index
  • uid, productid
  • time, uid, productid
  • time (ttl 2678400sec {31 Tage})
  • pci_cache
  • enthält zwei Sachen:
  • Colors by Views
  • Verteilung der Farben abhängig von den angeschauten Produkten für einen Zeitraum
  • Top Views
  • Welche Produkte wurden in einem bestimmten Zeitraum am häufigsten angeschaut
  • Anfragen werden bei Bedarf live ausgeführt und in den Cache gelegt
  • Nachts läuft ein Cronjob auf sg02, der den Cache für den gestrigen Tag/letzten Monat befüllt (Skript “update_cache_last_day.py” / Skript “update_cache_last_month.py”)
  • Index
  • uid, from_time, to_time
  • pci_stylecover
  • wird automatisch mit dem Skript “update_cache_stylecover.py” erzeugt
  • Läuft als cronjob auf sg02
  • kann manuell ausgeführt werden
  • Läuft recht lang (abhängig von der Anzahl der Styles und Größe der Kunden)
  • pci_styles
  • in dieser Collection werden Styles gespeichert
  • pci_brands
  • pci_colors
  • pci_picalike_cateogories
  • pci_shops
  • pci_cat_translation
  • pci_speedup
  • pci_trends
  • trend_fs.files, trend_fs.chunks
  • these collections contain images from trends
  • pci_upload
pci_doku.txt · Last modified: 2024/04/11 14:23 by 127.0.0.1