Play Flow

First, initialize Play

App.play.init(iWinConfig.sweepstakeID, iWinConfig.sweepstakeApiKey);

App.play.init() will evaluate parameters and check wether the Sweepstake is ok or not

Register one Player

App.play.postPlayer('USER_ID', iWinConfig.extra_fields)

USER_ID will be casted to (string)
iWinConfig.extra_fields must be an object formatted as shown below.
Pass only if your Sweepstake is configured to accept Extra Fields.
In case an Extra Field is not mandatory and the user leaves it empty you will not have to pass it, otherwise it will be validated

{
    'email' : {
        'key' : 'email',
        'value' : 'john@doe.com'
    }
},
{
    'first_name' : {
        'key' : 'first_name',
        'value' : 'John'
    }
},
{
    'last_name' : {
        'key' : 'last_name',
        'value' : 'Doe'
    }
}

Response:

{
    "status_code" : 201,
    "message" : "Player created",
    "response" : {
        "sweepstake_player_id" : "3505",
        "sweepstake_player_token" : "$2y$10$o\/yiziQIEuTKsFeYYz4f8eWjBPXj5IU0ai8YSk79AGjzfsvnba6MK",
        "object_id" : "pNzm4AlU1v"
        },
    "origin" : "",
    "errors" : false
}

Retrieve one or more Players

App.play.getPlayers('SWEEPSTAKE_PLAYER_ID', SORT_PARAMETERS)

SWEEPSTAKE_PLAYER_ID is the OBJECT_ID that identifies a single player for your Sweepstake
If SWEEPSTAKE_PLAYER_ID is null all Players will be retrieved and you can use some sort options shown below.

{
    'sort' : 'DESC' // or ASC
},
{
    'order' : 'object_id' // or any field valid for Player
},
{
    'limit' : 50 // max is 200
},
{
    'offset' : 0
},
{
    'fields' : 'object_id,created_at' // comma separated list of fields you want to retrieve
}

Both App.play.postPlayer() and App.play.getPlayers('SWEEPSTAKE_PLAYER_ID') - only when one single Player is retrieved - will respond with object_id (your SWEEPSTAKE_PLAYER_ID) and sweepstake_player_token (your SWEEPSTAKE_PLAYER_TOKEN)
This parameters are mandatory in order to perform the App.play.postPlay() call

Response

{
    "status_code" : 200,
    "message" : "Player found",
    "response" : {
        "object_id" : "pNzm4AlU1v",
        "sweepstake_player_id" : "3505",
        "sweepstake_player_token" : "$2y$10$o\/yiziQIEuTKsFeYYz4f8eWjBPXj5IU0ai8YSk79AGjzfsvnba6MK"
    },
    "errors":false
}

Perform Play call

App.play.postPlay(iWinConfig.ugc_fields)

App.play.playerID and App.play.playerToken must be filled
iWinConfig.ugc_fields must be an object formatted as shown below.
Pass only if your Sweepstake is configured to accept UGC Fields.
In case an UGC Field is not mandatory and the user leaves it empty you will not have to pass it, otherwise it will be validated

{
    'birthday' : {
        'key' : 'birthday',
        'value' : '1571809053'
    }
}