March 25, 20205 yr Hi, I'm trying to do a cURL PUT request using Insert from URL to Discord's API. I've successfully completed the PUT request using Postman, but I can't get it to work in Filemaker. I've successfully completed GET and POST requests with Filemaker, so I know my Discord authorization is working. Here's the url I'm using (with IDs removed): "https://discordapp.com/api/channels/<channel_id>/messages/<message_id>/reactions/<:name:id>/@me" Here are my curl options (with authorization removed): --request PUT --header "Authorization: <token>" --header "User-Agent: <user>" --header "Content-Type: application/json" I'm getting this error response: <!DOCTYPE html> <html lang=en> <meta charset=utf-8> <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width"> <title>Error 411 (Length Required)!!1</title> <a href=//www.google.com/><span id=logo aria-label=Google></span></a> <p><b>411.</b> <ins>That’s an error.</ins> <p>POST requests require a <code>Content-length</code> header. <ins>That’s all we know.</ins> The last line of the response makes me wonder if Filemaker is submitting it as POST and not PUT? Any suggestions are appreciated! Thanks!
March 26, 20205 yr I would think that the mention of POST is just an error in their documentation. As to your headers: you will have to add a Content-length one apparently. You also don't have to send a User-Agent so you can skip that.
March 26, 20205 yr Author Thanks Wim. Adding this solved it: --header "Content-Length: 0" Curiously, I had been able to get the PUT request to work with the Base Elements plugin without a Content-Length header: BE_HTTP_SetCustomHeader ( "Authorization" ; "<token>" ) & BE_HTTP_SetCustomHeader ( "Content-Type" ; "application/json" ) & BE_HTTP_PUTData ( "https://discordapp.com/api/channels/<channel_id>/messages/<message_id>/reactions/<emoji>/@me" ; "" ) Thanks for your help!
Create an account or sign in to comment