help Update Ads /sapi/v1/c2c/ads/update

I am using the corresponding endpoint and still getting this error:

Status Code: 401
Response Body: {‘code’: -1002, ‘msg’: ‘You are not authorized to execute this request.’}

I’m attaching part of the code I’m using to execute it. What I want to do is edit the price. I’m not sure what else to do at this point.

import hashlib
import hmac
import requests
import json
from urllib.parse import urlencode

Credenciales de Binance

API_KEY = ‘’
SECRET_KEY = ‘’
BASE_URL = ‘https://api.binance.com

Endpoint y parámetros

endpoint = ‘/sapi/v1/c2c/ads/update’
url = BASE_URL + endpoint

Cuerpo de la solicitud JSON

request_body = {
“advNo”: “12619026838743379968”,
“advStatus”: 1,
“asset”: “usdt”,
“fiatUnit”: “clp”,
“price”: 0.92,
“tradeMethods”: [
{
“identifier”: “Zinli”,
“payType”: “Zinli”
}
],
“tradeType”: “0”,
“updateMode”: “selective”
}

Convertir el cuerpo de la solicitud a cadena JSON

request_body_json = json.dumps(request_body, separators=(‘,’, ‘:’))

Crear la cadena de consulta ordenada para la firma HMAC

query_string = urlencode(sorted(request_body.items()))

Generar la firma HMAC SHA256

signature = hmac.new(SECRET_KEY.encode(‘utf-8’), query_string.encode(‘utf-8’), hashlib.sha256).hexdigest()

Headers requeridos con la API Key y la firma

headers = {
‘X-MBX-APIKEY’: API_KEY,
‘Content-Type’: ‘application/json’,
}

Agregar la firma al header

headers[‘Signature’] = signature

try:
# Realizar la solicitud POST con requests
response = requests.post(url, headers=headers, data=request_body_json)

# Imprimir la respuesta
print("Status Code:", response.status_code)
print("Response Body:", response.json())

except Exception as e:
print(“Error occurred:”, e)

Hey,
The endpoint /sapi/v1/c2c/ads/update is not included in the API P2P endpoints documentation. If you have any questions about P2P/C2C merchant endpoints, please kindly contact Customer Support team.

thanks i have instruccion but i can solve his problem


i have this but i cant used, im a merchant

pudiste resolver, ando en el mismo desarrollo

1 Like

YES I CAN

Como pudiste resolverlo amigo, ando en el mismo dilema. pudieras compartir la información?

1 Like

Como lo lograste, quiero hacer lo mismo.

1 Like

Telegram @sarksystem

También pueden probar el bot que hice gratis

Pd; No Hago integraciones gratuitas mil disculpas