xtrime-ru / TelegramApiServer

Fast, simple, async php telegram api server: MadelineProto + Amp HTTP Server
https://tg.i-c-a.su
MIT License
575 stars 129 forks source link

[Question] How to construct getInfo query. #48

Closed agolaszewski closed 4 years ago

agolaszewski commented 4 years ago

I am using https://docs.madelineproto.xyz/getDialogs.html to get all peers ids. To get details about peet I want to use : https://docs.madelineproto.xyz/getInfo.html searching by user name works http://127.0.0.1:9503/api/users/56cd3494-3722-4d2f-bc08-6a78f8dcb72a/123/getInfo?id=@extrime but I want to use channel/chat/user id I have tried http://127.0.0.1:9503/api/users/56cd3494-3722-4d2f-bc08-6a78f8dcb72a/123/getInfo?id=chat#492772765 http://127.0.0.1:9503/api/users/56cd3494-3722-4d2f-bc08-6a78f8dcb72a/123/getInfo?data[id]=chat#492772765 http://127.0.0.1:9503/api/users/56cd3494-3722-4d2f-bc08-6a78f8dcb72a/123/getInfo?id=492772765

and nothing above works. How to construct GET query for this endpoint?

xtrime-ru commented 4 years ago

All params in request should be urlencoded. https://www.urlencoder.org

chat#492772765 -> chat%23492772765

http://127.0.0.1:9503/api/users/56cd3494-3722-4d2f-bc08-6a78f8dcb72a/123/getInfo?id=chat%23492772765

Also you can use http://127.0.0.1:9503/api/users/56cd3494-3722-4d2f-bc08-6a78f8dcb72a/123/getId?id=xtrime to get correct numeric id. See this page for supported formats: https://docs.madelineproto.xyz/API_docs/types/Peer.html