crayfish Posted March 25, 2020 Posted March 25, 2020 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!
Wim Decorte Posted March 26, 2020 Posted March 26, 2020 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.
crayfish Posted March 26, 2020 Author Posted March 26, 2020 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!
Wim Decorte Posted March 26, 2020 Posted March 26, 2020 Pretty sure that the BE plugin adds it automatically, same as Postman does...
Recommended Posts
This topic is 1955 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now