メインコンテンツまでスキップ

Get started with Extend SDK sample CLI app

Last updated on April 22, 2025

Overview

The AccelByte Extend SDK is provided to help developers invoke AccelByte Gaming Services (AGS) endpoints from within their backend code, or other automation such as CI/CD pipelines. Extend SDK sample CLI application is a sample command line application to interact with AccelByte Extend SDK. You can use it as it is or use it as a reference for your own application.

Goals

In this guide you will:

  • Download Extend SDK sample CLI app.
  • Build the application.
  • Run the application.

Prerequisites

In order to start on this guide, you should have:

  • Access to the AccelByte Gaming Services (AGS) (demo environment):
    • Use <your environment's domain URL> for AB_BASE_URL environment variable.
      • Example for AGS Shared Cloud customer: https://spaceshooter.prod.gamingservices.accelbyte.io
      • Example for AGS Private Cloud customer: https://dev.customer.accelbyte.io
    • Create an OAuth Client with client type Confidential.
      • Use Client ID value for AB_CLIENT_ID environment variable.
      • Use Client Secret value for AB_CLIENT_SECRET environment variable.
  • AccelByte Python Extend SDK
  • Access to the following tools:
    • Git
    • Python 3.10
    • Python IDE

Build CLI sample app

  1. Pull AccelByte Python Extend SDK repository.
  2. Go to samples/cli.

Python can use python command line directly without building the app.

Using CLI sample app

Set up environment variables

You have to declare these environment variables below:

AB_BASE_URL (required)

AB_CLIENT_ID (required)

AB_CLIENT_SECRET (required for private OAuth client only)

export AB_CLIENT_ID=<value>
export AB_CLIENT_SECRET=<value>
export AB_BASE_URL="https://<environment>.accelbyte.io"

# To check if you use the correct value
echo AB_CLIENT_ID
echo $AB_CLIENT_SECRET
echo $AB_BASE_URL

Use the CLI sample app

$ python -m accelbyte_py_sdk_cli --help

Usage: python -m accelbyte_py_sdk_cli [OPTIONS] COMMAND [ARGS]...

Options:
--help Show this message and exit.

Commands:
...
iam-auth-code-request-v3
iam-authorization
iam-authorize-v3
iam-ban-user
iam-create-client
iam-create-client-by-namespace
iam-create-role
iam-disable-user
iam-disable-user-ban
iam-enable-user
iam-enable-user-ban
iam-forgot-password
iam-get-bans-type
iam-get-client
iam-get-clients
iam-get-country-location-v3
iam-get-jwks
iam-get-jwksv3
iam-get-list-ban-reason
iam-get-user-ban-history
iam-get-user-by-login-id
iam-get-user-by-platform-user-id
iam-get-user-by-user-id
iam-get-user-information
iam-get-user-platform-accounts
iam-get-user-verification-code
iam-get-users-by-login-ids
...

You can get more information for each command by using this syntax:

$ python -m accelbyte_py_sdk_cli COMMAND --help
$ python3 -m accelbyte_py_sdk_cli iam-get-bans-type --help

Usage: python -m accelbyte_py_sdk_cli iam-get-bans-type [OPTIONS]

Options:
--login_as [client|user]
--help Show this message and exit.

Most commands will require you to login as either a client or as a user. For these commands you'll have to pass either --login_as client or --login_as user.

Examples

Usage: python -m accelbyte_py_sdk_cli iam-get-bans-type [OPTIONS]

Options:
--login_as [client|user]
--help Show this message and exit.

$ python -m accelbyte_py_sdk_cli iam-get-bans-type --login_as user

GetBansType success success
Usage: python -m accelbyte_py_sdk_cli iam-public-create-user-v3 [OPTIONS] DISPLAY_NAME EMAIL_ADDRESS
DATE_OF_BIRTH COUNTRY PASSWORD

Options:
--namespace TEXT
--role_id TEXT
--login_as [client|user]
--help Show this message and exit.

$ python -m accelbyte_py_sdk_cli iam-public-create-user-v3 eagerhamster6800 vi7xUuNc4j@fakemail.com 2000-09-23 US "****" --login_as client

PublicCreateUserV3 success
Usage: python -m accelbyte_py_sdk_cli iam-admin-get-my-user-v3 [OPTIONS]

Options:
--login_as [client|user]
--help Show this message and exit.

$ python -m accelbyte_py_sdk_cli iam-admin-get-my-user-v3 --login_as user

AdminGetMyUserV3 success
Usage: python -m accelbyte_py_sdk_cli iam-admin-update-client-v3 [OPTIONS] CLIENT_ID
CLIENT_UPDATE_REQUEST

Options:
--namespace TEXT
--login_as [client|user]
--help Show this message and exit.

$ python -m accelbyte_py_sdk_cli iam-admin-update-client-v3 **** {"clientName": "****"} --login_as user

AdminUpdateClientV3 success
Usage: python -m accelbyte_py_sdk_cli iam-admin-update-user-v3 [OPTIONS] USER_ID

Options:
--country TEXT
--date_of_birth TEXT
--display_name TEXT
--language_tag TEXT
--user_name TEXT
--namespace TEXT
--login_as [client|user]
--help Show this message and exit.

$ python -m accelbyte_py_sdk_cli iam-admin-update-user-v3 **** --date_of_birth 2000-09-23 --login_as user

AdminUpdateUserV3 success

Please read CLI sample app README for more detailed information.