Entitlements - Redeem Code
Description
Redeems one or more provided codes to the authenticated Twitch user.
warning
Twitch decommissioned this endpoint on 2023-02-27.
Method Definition
@Deprecated
@RequestLine("POST /entitlements/codes?code={code}&user_id={user_id}")
@Headers("Authorization: Bearer {token}")
HystrixCommand<CodeStatusList> redeemCode(
@Param("token") String authToken,
@Param("code") List<String> code,
@Param("user_id") Integer userId
);
Required Parameters
Name | Type | Description |
---|---|---|
authToken | string | App Access Token |
code | string | The code to redeem to the authenticated user’s account. |
userId | integer | Represents a numeric Twitch user ID |
Code-Snippets
redeem code and print status
- Java
- Kotlin
- Groovy
CodeStatusList codeStatusList = twitchClient.getHelix().redeemCode(authToken, Arrays.asList("KUHXV-4GXYP-AKAKK"), 156900877).execute();
codeStatusList.getStatuses().forEach(codeStatus -> {
System.out.println(codeStatus.getCode() + " " + codeStatus.getStatus());
});
val codeStatusList = twitchClient.helix.redeemCode(authToken, listOf("KUHXV-4GXYP-AKAKK"), 156900877).execute()
codeStatusList.statuses.forEach { codeStatus ->
println("${codeStatus.code} ${codeStatus.status}")
}
def codeStatusList = twitchClient.helix.redeemCode(authToken, ["KUHXV-4GXYP-AKAKK"], 156900877).execute()
codeStatusList.statuses.each { codeStatus ->
System.out.println("${codeStatus.code} ${codeStatus.status}")
}