Get Treatments
The Get Treatments API fetches all of the details that are needed for rendering the treatments in your app or other surface.
API Definition
POST
https://apis.auxia.io/v1/GetTreatments
Path Parameters
api_key
String
A string API key that is issued to each project or company that uses Auxia.
This can either be set in the request parameters or in the header
Headers
x-api-key
String
A string API key that is issued to each project or company that uses Auxia. This API key should have permission to call this API.
This can either be set in the request parameters or in the header.
Raw request body
Example curl
Response
Schema Reference
Request
projectId
string
Required
For a given customer's project, this should always be the same.
userId
string
Required
This is the Unique ID for every user.
contextualAttributes
json
Optional
The set of additional attributes from the app’s context. Example: Current screen, recent actions, or context selections of the user. Each contextual attribute is a key value pair. What to include: 1. Any user attributes that are potentially newer than what Auxia has last seen. This enables the latest signals to be included in the rule processing and ML models for the treatment selection. 2. Other signals identifying the user’s current context in the app. For example, this could be last_button_clicked or current_screen_id. Duplicate attributes with the same key will throw an exception. Examples:
(“key”: “profile_id”, “stringValue”: “pr1234”)
( “key”: “profile_id”,“integerValue”: 10)
surfaces
json
Required
Atleast one surface should be provided in the request. Each surface contains:
"surface" is a client configured parameter to request treatments for a particular UI component, screen (home screen), or use case (coupon). A typical example of surface is "HOME_SCREEN" or "PURCHASE_SCREEN".
"maximumTreatmentCount" (Optional) is the maximum number of treatments that should be returned to the client for the given surface. If no value is set, defaults to 1.
"minimumTreatmentCount"(Optional) is the minimum number of treatments that should be returned to the client for a given surface. If this field is set, the response is guaranteed to have either 0 or greater than equal to the value of minimumTreatmentCount number of treatments. If no value is set, it defaults to 0.
Example:
(“surface”: “CAROUSEL”, “maximumTreatmentCount”: 10, "minimumTreatmentCount" : 1)
languageCode
string
Optional
The language code that is being requested for the content of the treatment. Format: IETF BCP 47. If this field is left unspecified, a default language (en) is used. Treatments that do not have translations for the requested language will not be returned.
maximumTreatmentCount
int64
Optional
The maximum amount of treatments that should be returned for the client. If no value is set, this defaults to 1.
Response
responseId
string
Unique ID generated for each call to getTreatments. This ID is global to the response compared to UserTreatment.treatmentTrackingId that is specific to each treatment in this response. The treatment ID is required to ensure there is a sufficient feedback loop instead of this global response ID unless zero treatments were returned in the response.
userTreatments
json (see table below)
List of treatments that contain the information needed to render them in your UI or messaging system.
userTreatments
treatmentId
string
A unique ID that identifies a specific treatment. It can also be found in the Auxia console in the "Overview" section under "Treatments".
treatmentTrackingId
string
A unique ID that references not only the specific treatment, but also the specific RPC call in which the treatment was returned.
surface
string
The name of the surface, as defined above in the request, on which this treatment should be rendered or for which this treatment should be used.
rank
int64
The rank of the treatment in the response for the given surface. Auxia ranks and sorts the treatments for each user before they are provisioned in the response.
treatmentType
string
A client configured parameter which is used to decide how to render the content. An example being "In App Content Card", which might mean that the client is going to render the content with a title and text, accompanied with an image. Another example can be "Banner", which might be a different UI component.
treatmentContent
json
The content that should be displayed (in app) or included (messages) Placeholders in the content can be replaced by personalization signals. Content format is owned by Auxia Customers via the Treatment Config UI and they may choose how to represent placeholders. Depending on the client platform, Content can be plain text, JSON, HTML, js snippet, or any other format that can directly be inserted into the client UI. Example: { “content”: ”{ title: ‘Check out your trends’, description: ‘87% of users found this feature useful’, cta_name: ‘View trends’, cta_link: ‘/actionscreen’}“}
contentLanguageCode
string
Language code for the content of the treatment. Format: IETF BCP 47.
Appendix
Language and translations
Treatment content such as the in_app_content_card can be translated into different languages.
To use translations, select a specific language code in the “language_code” JSON field when posting to the following:
Example
Response
Non-translated
If a treatment is not translated into the language requested, then the treatment will not be returned.
Example
Response
Last updated