Last active
April 22, 2024 02:37
-
-
Save wjkoh/32b2aa94a2ec90424eb7f8acdca6b302 to your computer and use it in GitHub Desktop.
cURL: How to convert a file to a Base64 encoded string and send it as JSON to HTTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
BASE64=$(base64 -i yann-lecun_resize.jpg) | |
curl --request POST \ | |
--url http://localhost:8080/v1/images \ | |
--header 'Content-Type: application/json' \ | |
--data '{ "image": "'${BASE64}'" }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment