Created
April 19, 2022 11:07
-
-
Save epomatti/55fc47675550835678140b3fc5bf6ea1 to your computer and use it in GitHub Desktop.
Upload CSV file using CURL
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
#!/bin/bash | |
# Load Variables | |
source dev.local.env | |
# Decrypt the API password | |
api_password=$(gpg --decrypt --no-symkey-cache $pwd_encrypted_file) | |
# Authenticate to MuleSoft and get the token (requires jq to be installed) | |
access_token=$(curl -X POST -u $username:$api_password -d $auth_url | jq -r '.access_token') | |
# Uploads the file | |
response=$(curl -X POST -H "Authorization: Bearer $access_token" -F "file=@$file;type=text/csv" $url)\ | |
echo $response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment