multipart - How to upload a file in Telegram Bott api using Http client? -


i have tried send files using multipart form data, following error:

{"description":"error: bad request: chat_id empty","error_code":400,"ok":false}

here code snippet. can me out committing error?

public httpresponse<jsonnode> senddocument(integer chat_id,file f1) throws unirestexception {   return unirest.post(endpoint + token + "/senddocument")   header("accept", "application/json")  .field("chat_id", chat_id)  .field("document", f1)  .asjson(); } 

well, said chat_id empty. that's obvious error! question, there 2 ways senddocument telegram.

  1. that file in servers, should pass file_id in "document" field
  2. you want upload file device , said

must posted using multipart/form-data in usual way files uploaded via browser

if doing upload section correct, make sure chat_id not empty.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -