Layer 231
ToncenterPerformApiRequest
Perform a request to the TON Center HTTP API through Telegram's servers, so clients can query the TON blockchain (balances, transactions, contract state, etc.) without their own TON Center API key. The JSON answer of the endpoint is returned as-is in the response field.
method
toncenter.performApiRequest#8d7bdd61 flags:# post:flags.0?true endpoint:string query:flags.1?string payload:flags.2?string = toncenter.ApiResponse;
Parameters
| Name | Type | Description |
|---|---|---|
| Post | flags.0?true | If set, send a POST request with payload as the body; otherwise send a GET request |
| Endpoint | string | TON Center API endpoint (method) to call |
| Query | flags.1?string | URL-encoded query string with the endpoint's parameters |
| Payload | flags.2?string | JSON request body, for POST requests |
Returns
toncenter.ApiResponseGogram Example
// GET request to a TON Center API endpoint, proxied through Telegram. res, err := client.ToncenterPerformAPIRequest(false, "getAddressBalance", "address=EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N", "") if err != nil { log.Fatal(err) } fmt.Println("response JSON:", res.Response.Data)