Remote Config
The HTTP API can only be used in a server environment.
You can use the HTTP API to check the results of remote config distributions for users.
Authentication
Authentication is done through the SDK key. The SDK key must be sent in the HTTP header.
Depending on where you are calling the API from, set one of the Browser, App, or Server SDK keys in the header.
X-HACKLE-API-KEY: {YOUR_SDK_KEY}
Request
POST https://api.hackle.io/v1/remote-config
Request Body
Field | Type | Required | Description |
---|---|---|---|
parameterKey | number | O | Remote config parameter Key |
defaultValue | string, number, boolean | O | Value returned when the remote config cannot be determined |
user | User object | O | User to distribute |
The Type of defaultValue must match the parameter type in the remote configuration setting.
If the Type of defaultValue and the parameter type do not match, api returns defaultValue. (Reason for distribution: TYPE_MISMATCH)
If the parameter type is JSON, defaultValue must be entered as string Type.
User Object
Field | Type | Required | Description |
---|---|---|---|
id | string | X | Default identifier |
userId | string | X | User ID (can use Hackle integrated identifier) |
deviceId | string | X | Device ID (can use Hackle integrated identifier) |
identifiers | object | X | Custom identifiers \nkey(string)-value(string) Pair |
properties | object | X | User properties \nkey(string)-value(string|number|boolean) Pair |
Example
curl -i -X POST \
'https://api.hackle.io/v1/remote-config' \
-H 'X-HACKLE-API-KEY: YOUR_SDK_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"parameterKey": "parameter_key",
"defaultValue": "default_value",
"user": {
"id": "ae2182e0",
"userId": "19285035",
"deviceId": "ae2182e0",
"identifiers": {
"sessionId": "16930492542",
"myCustomId": "ff01eae2"
},
"properties": {
"grade": "GOLD",
"age": 30,
"isLogin": true
}
}
}'
Response
200 OK
In case of a successful request, it returns a 200 response and the distribution result.
Response Body
Field | Type | Description |
---|---|---|
value | string, number, boolean | Remote config parameter value |
reason | string | Reason for distribution |
Example
{
"value": "paramter_value",
"reason": "DEFAULT_RULE"
}
400 Bad Request
Returns a 400 status if the request information is invalid.
401 Unauthorized
Returns a 401 status if the X-HACKLE-API-KEY
header is missing or the SDK key is invalid.
Updated 5 months ago