|
| 1 | +## Read profile info |
| 2 | + |
| 3 | +```shell |
| 4 | +# Using email as user identifier |
| 5 | +curl https://<%= config[:api_endpoint] %>/profile?email=...&shop_id=...&shop_secret=... |
| 6 | + |
| 7 | +# Using phone as user identifier |
| 8 | +curl https://<%= config[:api_endpoint] %>/profile?phone=...&shop_id=...&shop_secret=... |
| 9 | +``` |
| 10 | + |
| 11 | +```javascript |
| 12 | +<%= config[:js_sdk_name] %>('profile', 'get', function(profile) { |
| 13 | + // Here you can use all properties of profile's object |
| 14 | + console.log(profile.gender); |
| 15 | + console.log(profile.fashion.sizes.shoe); |
| 16 | +}, |
| 17 | +// Use `true`, to work in single page sites. |
| 18 | +// Default - `false` |
| 19 | +false |
| 20 | +); |
| 21 | +``` |
| 22 | + |
| 23 | +> The REST method returns this JSON structure for requests where a secret key was provided |
| 24 | + |
| 25 | +```json |
| 26 | +{ |
| 27 | + "first_name": "...", |
| 28 | + "last_name": "...", |
| 29 | + "email": "...", |
| 30 | + "phone": "...", |
| 31 | + "fb_id": "...", |
| 32 | + "vk_id": "...", |
| 33 | + "telegram_id": "...", |
| 34 | + "loyalty_id": "...", |
| 35 | + "loyalty_card_location": "...", |
| 36 | + "loyalty_status": "...", |
| 37 | + "loyalty_bonuses": "...", |
| 38 | + "loyalty_bonuses_to_next_level": "...", |
| 39 | + "gender": "...", |
| 40 | + "location": "...", |
| 41 | + "age": "...", |
| 42 | + "birthday": "...", |
| 43 | + "bought_something": "...", |
| 44 | + "tags": [ |
| 45 | + "...", |
| 46 | + "..." |
| 47 | + ], |
| 48 | + "custom_properties": { |
| 49 | + "prop_key_1": "prop_value", |
| 50 | + "prop_key_2": "prop_value" |
| 51 | + }, |
| 52 | + "additional_phones": [], |
| 53 | + "additional_emails": [], |
| 54 | + "additional_loyalty_ids": [], |
| 55 | + "orders": [ |
| 56 | + { |
| 57 | + "id": "...", |
| 58 | + "value": "...", |
| 59 | + "status": "...", |
| 60 | + "items": [ |
| 61 | + { |
| 62 | + "id": "...", |
| 63 | + "price": "...", |
| 64 | + "name": "...", |
| 65 | + "quantity": "..." |
| 66 | + }, |
| 67 | + { |
| 68 | + "id": "...", |
| 69 | + "price": "...", |
| 70 | + "name": "...", |
| 71 | + "quantity": "..." |
| 72 | + } |
| 73 | + ] |
| 74 | + } |
| 75 | + ] |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | +> The REST method returns this JSON structure with publicly available profile data if a secret key was not provided in the request |
| 80 | + |
| 81 | +```json |
| 82 | +{ |
| 83 | + "has_email": true, |
| 84 | + "computed_gender": "male", |
| 85 | + "gender": "male", |
| 86 | + "bought_something": true, |
| 87 | + "id": "YOUR ID", |
| 88 | + "custom_properties": { |
| 89 | + "favorite_color": "blue", |
| 90 | + "subscription_level": "premium" |
| 91 | + } |
| 92 | +} |
| 93 | +``` |
| 94 | + |
| 95 | +> JS SDK method returns simplified anonymous structure to prevent data stealing |
| 96 | + |
| 97 | +```json |
| 98 | +{ |
| 99 | + "fashion_sizes": ["..."], |
| 100 | + |
| 101 | + "gender": "m or f", |
| 102 | + |
| 103 | + "cosmetic_hair": ["..."], |
| 104 | + "allergy": "bool", |
| 105 | + "cosmetic_skin": ["..."], |
| 106 | + "cosmetic_perfume": ["..."], |
| 107 | + |
| 108 | + "compatibility": null, |
| 109 | + "vds": null, |
| 110 | + |
| 111 | + "jewelry": null, |
| 112 | + |
| 113 | + "realty": ["..."], |
| 114 | + |
| 115 | + "children": ["..."], |
| 116 | + "child_gender": "m or f", |
| 117 | + |
| 118 | + "pets": ["..."], |
| 119 | + |
| 120 | + "income_level": "cheap" |
| 121 | +} |
| 122 | +``` |
| 123 | + |
| 124 | + |
| 125 | +You can read profile info from the CRM using an API or SDK. |
| 126 | + |
| 127 | +In the case of using the REST API (when using an email or phone number as the user ID), you must provide a secret key to the method to get a full response. |
| 128 | + |
| 129 | +However, there is publicly available data you can retrieve without providing a secret key in your request. |
0 commit comments