The API documentation includes a collection of requests with examples. It is designed for easy browsing, allowing you to explore the functionality even without a Postman account.
If you are already using Postman, you can fork and run the collection directly in your own account.
Authorization
This API uses basic authentication. For the authorization, you will need to use your section's API-key.
Processing the received response (JSON) and rendering the result.
Passing information about a user interactions with the campaign using engagement.
Page: Sending Page View Information
For personalization to work correctly, it is necessary to send information about page views on the website (or screen views in the application) for all the users. Typically, this task is solved together with the campaign request via a dedicated parameter in the choose request (see below). However, there is also the option to send page view information separately from the campaign request using /page endpoint.
When using hybrid implementation, it is necessary to send page view information for the pages where there is no frontend script.
page: Sending Page View Information
post
Store page view event
Authorizations
Body
Responses
200
Successful response
application/json
422
Bad request
post
/ssapi/page
Events: Transmitting Information About Events
In order to collect statistics and optimize campaigns, it is necessary to provide Gravity Field with information about user actions on the site (in the application).
It is recommended to exclude events generated by bots and the QA team from the transmitted data.
events: Transmitting Information About Events
post
Store event
Authorizations
Body
Responses
200
Successful response
application/json
post
/ssapi/event
200
Successful response
Choose: Requesting Campaigns
Both Custom Code and Recommendations campaigns could be requested by choose.
The campaigns are identified in the requests by API Selector Name or API Selector Groups.
In case of Hybrid implementation you can use a choose-request withnull in user.slid andsession.sl to get new identifiers.
choose: Requesting Campaigns
post
Choose variation
Authorizations
Body
Responses
200
Successful response
application/json
post
/ssapi/choose
200
Successful response
No content
To handle errors gracefully, you need to
Set a response timeout.
In case of timeout or response different from status 200, you will need either
display nothing
display a stub (default banner, pre-installed set of products in the widget, etc.). Additionally, we recommend sending a custom fallback event to Gravity Field.
Engagement: Passing Information About Users’ Interactions With Personalization Campaigns
In order to gather valuable statistics and further optimize your campaigns, you should pass the information about users's interactions with personalization campaigns.
engagement: Passing Information About Users’ Interactions With Personalization Campaigns
post
Store click variation
Authorizations
Body
Responses
200
Successful response
application/json
post
/ssapi/engagement
200
Successful response
Rate limits
All requests are limited to 500 requests per second (RPS) per section.
Additional Recommendations
Keep API keys safe and do not disclose them to third parties
Ensure that all API calls for the same user within one session have the same User and Session IDs
Request recommendations asynchronously to speed up content rendering
Set a timeout for waiting for a response from the API. Prepare a default content option in advance for displaying when there is no response. It is also recommended to keep statistics on timings and cases when a response from the API was not received (additional events can be sent in case of response timeouts).
Debugging
You can view all your requests and corresponding responses in real-time in your Gravity Field account (Settings/API Logs).