Skip to content

Commit 1c4bf21

Browse files
Michael KechinovMichael Kechinov
Michael Kechinov
authored and
Michael Kechinov
committed
add init description
1 parent a9fed48 commit 1c4bf21

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

Diff for: .ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.0

Diff for: source/index.html.md

+40
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: REES46 API Reference
44
language_tabs:
55
- shell
66
- javascript
7+
- swift
78

89
toc_footers:
910
- <a href='#'>Sign Up for a Developer Key</a>
@@ -39,6 +40,45 @@ curl "https://api.rees46.com/?shop_id=357382bf66ac0ce2f1722677c59511"
3940
You must replace <code>357382bf66ac0ce2f1722677c59511</code> with your shop's API key.
4041
</aside>
4142

43+
# Initialize
44+
45+
## Start session
46+
47+
`GET https://api.rees46.com/init_script`
48+
49+
```shell
50+
curl https://api.rees46.com/init_script?ssid=SSID&shop_id=SHOPID&v=3&seance=SEANCE_ID&referrer=REF_URL
51+
```
52+
53+
```javascript
54+
(function(r){window.r46=window.r46||function(){(r46.q=r46.q||[]).push(arguments)};var s=document.getElementsByTagName(r)[0],rs=document.createElement(r);rs.async=1;rs.src='//cdn.rees46.com/v3.js';s.parentNode.insertBefore(rs,s);})('script');
55+
r46('init', 'SHOPID');
56+
```
57+
58+
```swift
59+
import REES46
60+
var sdk = createPersonalizationSDK(shopId: "SHOPID")
61+
```
62+
63+
Before using SDK or API you have to initialize SDK. Initialization takes current user identifier and requests API for project settings and this user preferences.
64+
65+
If you don't have user's identifier (new user), you have to request API's `init` method to generate new one. Store this identifier (it's named `ssid`) in local storage of mobile application or in database: you'll need it for the future requests to API.
66+
67+
<aside class="notice">
68+
This method must be requested on every opened page on the website. And only once, when you launch mobile app.
69+
</aside>
70+
71+
72+
### Query Parameters
73+
74+
Parameter | Required | Description
75+
--------- | ------- | -----------
76+
shop_id | true | Your API key
77+
ssid | false | Is mandatory if you have it. Request without `ssid` will generate new one in our DB. Use it as user ID for future requests.
78+
v | true | Version. Just use `3` as value.
79+
seance | true | User's temporary identifier for the current session. Must be regenerated every time user starts new session. Just unique string: `uuid8` is ok.
80+
referrer | false | Referrer page URL for web integration.
81+
4282
# Mobile push tokens
4383

4484
## Create new token

0 commit comments

Comments
 (0)