Hello all ,
I am trying to upload a picture to Telegram using Bot api but with no luck
Here is my code:
and here is method documentation
https://core.telegram.org/bots/api#sendphoto
I get 415 status code means Unsupported Media Type .
Can any one please help me and tell what to change in the code to make it work .
By the way sending message is working correctly (using GET) which means there is no problems in api connection .
I am trying to upload a picture to Telegram using Bot api but with no luck
Here is my code:
B4X:
Dim fd As FileData
fd.Initialize
fd.Dir = path
fd.FileName = fname
fd.KeyName = "photo"
fd.ContentType = "multipart/form-data"
Dim files As List
files.Initialize
files.Add(fd)
hc.Initialize("hc")
Dim req As HttpRequest
Dim NV As Map
NV.Initialize
NV.Put("chat_id", chat_id)
NV.Put("caption", caption)
req=MultipartPost.CreatePostRequest(link&"/sendPhoto",NV,files)
hc.Execute(req, 1)
and here is method documentation
https://core.telegram.org/bots/api#sendphoto
I get 415 status code means Unsupported Media Type .
Can any one please help me and tell what to change in the code to make it work .
By the way sending message is working correctly (using GET) which means there is no problems in api connection .