Studio GuideWorld SDK Guide
Log In

Deleting Specific Ranking Data Within the Leaderboard

You can use the OpenAPI to delete specific ranking data within the leaderboard.

To use the OpenAPI, please first obtain an OpenAPI Key from ZEPETO Studio.

Afterwards, obtain a JWT authentication token according to the OpenAPI format and call the Delete Rank OpenAPI.

❗️

Caution

  • Please enter the UTC Timestamp value at the same time value as when the JWT authentication token is issued.

Example Code - Python

import time
import jwt
import uuid
import hashlib
import base64

import requests as requests
import simplejson as json

access_key = 'YOUR_ACCESS_KEY'
secret_key = 'YOUR_SECRET_KEY'

uri = '/operation/v1/rank/delete'

hash = hashlib.sha256()
hash.update(uri.encode())

reqTimestamp = int(time.time())

json_param = { 
    "worldId": "", 
    "leaderboardId": "", 
    "member": "", #user_id
    "reqTimestamp": reqTimestamp 
    # "prevRanking": false, # nullable 
}

param_hash = hashlib.sha256()
param_hash.update(json.dumps(json_param, ensure_ascii=False,
                  encoding="surrogatepass").encode())

jwt_payload = {
    'access_key': access_key,
    'nonce': str(uuid.uuid4()),
    'uri_hash': base64.b64encode(hash.digest()).decode('utf8'),
    'body_hash': base64.b64encode(param_hash.digest()).decode('utf8'),
}

jwt_token = jwt.encode(jwt_payload, secret_key)
authorization = 'Bearer {}'.format(jwt_token)
print(reqTimestamp)
print(authorization)


url = "https://openapi.zepeto.zone" + uri # openapi url

headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "Authorization": authorization
}

response = requests.post(url, json=json_param, headers=headers)
print(response.status_code)
print(response.text)