---
title: 在排行榜中删除特定排名数据
slug: world-sdk-guide-ch/C1MokLSXovzx81F39JBvP
docTags: 
createdAt: 2024-09-02T08:34:13.134Z
---

您可以使用 OpenAPI 删除排行榜中的特定排名数据。

要使用 OpenAPI，请首先 [获取 OpenAPI 密钥](docId\:TEviE5E-km35X9Z5OEAMP) 来自 ZEPETO Studio。

之后， [获取 JWT 认证令牌](docId:-QkBesCNfwm_RWNF4MjIC) 根据 OpenAPI 格式并调用 [删除排名 OpenAPI](docId\:mzZQePkJoy5av2G4F8nDz) 。

:::hint{type="danger"}
- 请在 JWT 认证令牌发放时输入相同的 UTC 时间戳值。
:::



## 示例代码 - Python

```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)
```

