Перейти до змісту

API Reference: Multiple Configs

Retrieve Multiple Content Schematic

You can retrieve a collection of content from Joystick in one call.

Getting Multiple Configs at Once via API

Request

End Point

POST https://api.getjoystick.com/api/v1/combine/?c=[":cid_1", ":cid_2", ":cid_3"]&dynamic=true

Replace the :contentId_00 indicated with the Configuration Content Id you would like. :contentId is not case sensitive.

Request Attribute Value Required Notes
Content-Type application/json Yes
x-api-key Your API key Yes The API key you created for the environment you are targeting. This is different for each environment. Created and managed in the Environment page.

Request Query Parameters / Options

Query Param Description
c Array of Strings. Required. This is the list of contentIds you'd like to be returned.
dynamic Optional. Indicates to have the content wrapped in the 'data' object and additional metadata about segmentation and ab testing. See the response section for the output.
Usage: /combine/?c=["cid_1", "cid_2"]&dynamic=true
responseType Optional. Case sensitive. Indicates to serialize the 'data' object on the dynamic response. Must be used in conjunction with 'dynamic'. See the response section for the output.
Usage: /combine/?c=["cid_1", "cid_2"]&dynamic=true&responseType=serialized

Request Body

The request body should be JSON, and cannot be empty. It must at minimum consist of the following snippet.

{
    "u": "",
    "p": {}
}   
{
    "u": "the-unique-user-id",
    "v": "3.2.1",
    "p": {
        "level": 1,
        "location": "north_pole",
        "balance": 101,
        "days_since_install": 14
    }
}   
Attribute Requirement Description
u String. Required. This is the unique identifier for a particular user. We use this identifier to split users into sticky AB Test groups. Send an empty string at minimum.
p Object. Required. This is a dictionary of key:value attributes that can be used by Joystick for segmentation (different config content can be returned based on the attributes you send). Send an empty object at minimum. View Usage Details
v Optional. This is the version of your app that is making the request. We highly recommend sending this. Must be a three-part semantic version e.g. "3.2.1"

Example

curl --location --request POST 'https://api.getjoystick.com/api/v1/combine/?c=["contentId_01", "contentId_02", "contentId_03"]' \
--header 'X-Api-Key: YOUR-API-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{"u": "", "p": {}}'

Troubleshooting

Having issues? View our troubleshooting guide.

Response

The response body will be a contentId keyed object. Each object is exactly the same as if the content had been requested individually.

Default Response

The default response returns just the configuration content to you under each contentId key.

200 OK
{
    "contentId_01": { "greeting": "Hello, world!" },
    "contentId_02": { "greeting": "Hello, planet!" },
    "contentId_03": { "greeting": "Hello, solar system!" }
}   

Wrapped Response with Metadata

This is the response if the dynamic=true option is set on the request query parameter. You'll get back additional information about the segmentation and AB testing transforms/mutations applied, if there are any.
(/combine/?c=["contentId_01", "contentId_02", "contentId_03"]&dynamic=true)

200 OK
{
    "contentId_01": {
        "data": { "greeting": "Hello, world!" },
        "hash": "2277e0d4",
        "meta": { "uid": 0, "mod": 0, "seg": []}
    },
    "contentId_02": {
        "data": { "greeting": "Hello, planet!" },
        "hash": "abcd1234",
        "meta": { "uid": 0, "mod": 0, "seg": []}
    },
    "contentId_03": {
        "data": { "greeting": "Hello, solar system!" },
        "hash": "defg9876",
        "meta": { "uid": 0, "mod": 0, "seg": []}
    }
}   

Wrapped Response, Serialized with Metadata

This is the response if both dynamic=true and responseType=serialized options are set on the request query parameter.
(/combine/?c=["contentId_01", "contentId_02", "contentId_03"]&dynamic=true&responseType=serialized)

200 OK
{
    "contentId_01": {
        "data": "{ \"greeting\": \"Hello, world!\" }",
        "hash": "2277e0d4",
        "meta": { "uid": 0, "mod": 0, "seg": []}
    },
    "contentId_02": {
        "data": "{ \"greeting\": \"Hello, planet!\" }",
        "hash": "abcd1234",
        "meta": { "uid": 0, "mod": 0, "seg": []}
    },
    "contentId_03": {
        "data": "{ \"greeting\": \"Hello, solar system!\" }",
        "hash": "defg9876",
        "meta": { "uid": 0, "mod": 0, "seg": []}
    }
}   

More Information

To understand the details of each config object, please refer to our Single Content API for more information.

Let's Go!

Get a Free Sandbox Account

Equip your team with rocket boosters. Get a free sandbox account today .

Join the Community

Head over to our Discord server for tips, support and more: Discord