Upload media to WhatsApp cloud API - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Indy (https://www.atozed.com/forums/forum-8.html) +--- Forum: Indy General Discussion (https://www.atozed.com/forums/forum-9.html) +--- Thread: Upload media to WhatsApp cloud API (/thread-2969.html) |
Upload media to WhatsApp cloud API - Lior I - 12-18-2022 I need to upload a PDF file to a WhatsApp Cloud API. Can someone help me translate this WhatsApp curl example code to Delphi pascal? Here is the code from the WhatsApp documentation (JPEG example): Code: curl -X POST \ I don't know how to translate the file parameter. It includes both path and file type attributes. Code: -F 'file=@/local/path/file.jpg;type=image/jpeg' I use Delphi RIO 10.3 Thanks in advance RE: Upload media to WhatsApp cloud API - 3ddark - 12-19-2022 This example http/https post. You can do this using the Indy IdHttp or Delphi NetHTTPClient component. Post example with link Add Request header for Authorization If you want to know how the structure works, you should research what is HTTP/https request/response. RE: Upload media to WhatsApp cloud API - rlebeau - 12-19-2022 (12-18-2022, 10:24 AM)Lior I Wrote: Can someone help me translate this WhatsApp curl example code to Delphi pascal? If you read curl's documentation, you would see that the -F parameter is for sending an HTML webform in multipart/form-data format. Indy's TIdHTTP has an overloaded Post() method which takes a TIdMultipartFormDataStream as input, eg: Code: uses RE: Upload media to WhatsApp cloud API - Lior I - 12-26-2022 Thank you Remy Lebeau. Problem solved. |